Skip to content

Commit

Permalink
feat: stub out transitions by default (#1411)
Browse files Browse the repository at this point in the history
* feat: stub out transitions by default

* fix: stub in global object
  • Loading branch information
lmiller1990 authored Apr 18, 2020
1 parent f102a9a commit 6f0a41a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/test-utils/src/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
export default {
stubs: {},
stubs: {
transition: true,
'transition-group': true
},
mocks: {},
methods: {},
provide: {},
Expand Down
20 changes: 20 additions & 0 deletions test/resources/components/component-with-transitions.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<template>
<div>
<transition>
<span v-if="!expanded" data-testid="expanded">
Content
</span>
</transition>
</div>
</template>

<script>
export default {
name: 'component-with-transitions',
data() {
return {
expanded: false
}
}
}
</script>
9 changes: 9 additions & 0 deletions test/specs/config.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describeWithShallowAndMount } from '~resources/utils'
import ComponentWithProps from '~resources/components/component-with-props.vue'
import { config, createLocalVue } from '@vue/test-utils'
import ComponentWithTransitions from '~resources/components/component-with-transitions.vue'

describeWithShallowAndMount('config', mountingMethod => {
const sandbox = sinon.createSandbox()
Expand Down Expand Up @@ -90,4 +91,12 @@ describeWithShallowAndMount('config', mountingMethod => {
})
expect(console.error).calledWith(sandbox.match('[Vue warn]'))
})

it('stubs out transitions by default', async () => {
const wrapper = mountingMethod(ComponentWithTransitions)
expect(wrapper.find('[data-testid="expanded"]').exists()).to.equal(true)
wrapper.setData({ expanded: true })
await wrapper.vm.$nextTick()
expect(wrapper.find('[data-testid="expanded"]').exists()).to.equal(false)
})
})

0 comments on commit 6f0a41a

Please sign in to comment.