import Vue from 'vue'
import injectStyles from './inject-styles'
import { isIE9 } from 'web/util/index'
import { nextFrame } from 'web/runtime/modules/transition'
if (!isIE9) {
describe('Transition mode', () => {
const duration = injectStyles()
const components = {
one: { template: '
{{view}}
`,
data: { view: 'one' },
components,
transitions: {
test: {
afterEnter () {
next()
}
}
}
}).$mount(el)
expect(vm.$el.textContent).toBe('one')
vm.view = 'two'
waitForUpdate(() => {
expect(vm.$el.innerHTML).toBe(
'
one
' +
'
two
'
)
}).thenWaitFor(nextFrame).then(() => {
expect(vm.$el.innerHTML).toBe(
'
one
' +
'
two
'
)
}).thenWaitFor(_next => { next = _next }).then(() => {
expect(vm.$el.innerHTML).toBe(
'
one
' +
'
two
'
)
}).then(() => {
expect(vm.$el.innerHTML).toBe(
'
one
' +
'
two
'
)
}).thenWaitFor(nextFrame).then(() => {
expect(vm.$el.innerHTML).toBe(
'
one
' +
'
two
'
)
}).thenWaitFor(duration + 10).then(() => {
expect(vm.$el.innerHTML).toBe(
'
two
'
)
}).then(done)
})
})
}