Skip to content

Commit 6f0a41a

Browse files
authoredApr 18, 2020
feat: stub out transitions by default (#1411)
* feat: stub out transitions by default * fix: stub in global object
1 parent f102a9a commit 6f0a41a

File tree

3 files changed

+33
-1
lines changed

3 files changed

+33
-1
lines changed
 

‎packages/test-utils/src/config.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
export default {
2-
stubs: {},
2+
stubs: {
3+
transition: true,
4+
'transition-group': true
5+
},
36
mocks: {},
47
methods: {},
58
provide: {},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<div>
3+
<transition>
4+
<span v-if="!expanded" data-testid="expanded">
5+
Content
6+
</span>
7+
</transition>
8+
</div>
9+
</template>
10+
11+
<script>
12+
export default {
13+
name: 'component-with-transitions',
14+
data() {
15+
return {
16+
expanded: false
17+
}
18+
}
19+
}
20+
</script>

‎test/specs/config.spec.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { describeWithShallowAndMount } from '~resources/utils'
22
import ComponentWithProps from '~resources/components/component-with-props.vue'
33
import { config, createLocalVue } from '@vue/test-utils'
4+
import ComponentWithTransitions from '~resources/components/component-with-transitions.vue'
45

56
describeWithShallowAndMount('config', mountingMethod => {
67
const sandbox = sinon.createSandbox()
@@ -90,4 +91,12 @@ describeWithShallowAndMount('config', mountingMethod => {
9091
})
9192
expect(console.error).calledWith(sandbox.match('[Vue warn]'))
9293
})
94+
95+
it('stubs out transitions by default', async () => {
96+
const wrapper = mountingMethod(ComponentWithTransitions)
97+
expect(wrapper.find('[data-testid="expanded"]').exists()).to.equal(true)
98+
wrapper.setData({ expanded: true })
99+
await wrapper.vm.$nextTick()
100+
expect(wrapper.find('[data-testid="expanded"]').exists()).to.equal(false)
101+
})
93102
})

0 commit comments

Comments
 (0)
Please sign in to comment.