Skip to content

Instantly share code, notes, and snippets.

@visualjerk
Last active June 1, 2019 19:46
Show Gist options
  • Save visualjerk/337b011fa3edc0582d3f09efce8435f3 to your computer and use it in GitHub Desktop.
Save visualjerk/337b011fa3edc0582d3f09efce8435f3 to your computer and use it in GitHub Desktop.
import { mount, config } from '@vue/test-utils'
import MyTransition from './my-transition.vue'
// Use default vue transition comp
config.stubs.transition = false
describe('MyTransition.vue', () => {
it('cleans styles after enter transition', () => {
const comp = {
template: `<div><my-transition><p v-show="show">foo</p></my-transition></div>`,
components: {
MyTransition
},
data() {
return {
show: false
}
}
}
const wrapper = mount(comp)
// This triggers asynchronous behaviour inside the comp
wrapper.vm.show = true
const foo = wrapper.find('p')
expect(foo.element.style.cssText).toEqual('') // This will fail
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment