Skip to content

Commit b679b27

Browse files
committed
feat: stub out transitions by default
1 parent 1630799 commit b679b27

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

packages/create-instance/create-instance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default function createInstance(
5555
const stubComponentsObject = createStubsFromStubsObject(
5656
componentOptions.components,
5757
// $FlowIgnore
58-
options.stubs,
58+
{ ...options.stubs, transition: true },
5959
_Vue
6060
)
6161

Lines changed: 20 additions & 0 deletions
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/mounting-options/stubs.spec.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import ComponentWithChild from '~resources/components/component-with-child.vue'
2+
import ComponentWithTransitions from '~resources/components/component-with-transitions.vue'
23
import ComponentWithNestedChildren from '~resources/components/component-with-nested-children.vue'
34
import Component from '~resources/components/component.vue'
45
import ComponentAsAClass from '~resources/components/component-as-a-class.vue'
@@ -53,6 +54,14 @@ describeWithShallowAndMount('options.stub', mountingMethod => {
5354
expect(wrapper.findAll(Component).length).to.equal(1)
5455
})
5556

57+
it('stubs out transitions by default', async () => {
58+
const wrapper = mountingMethod(ComponentWithTransitions)
59+
expect(wrapper.find('[data-testid="expanded"]').exists()).to.equal(true)
60+
wrapper.setData({ expanded: true })
61+
await wrapper.vm.$nextTick()
62+
expect(wrapper.find('[data-testid="expanded"]').exists()).to.equal(false)
63+
})
64+
5665
it('replaces component with a component', () => {
5766
const mounted = sandbox.stub()
5867
const Stub = {

0 commit comments

Comments
 (0)