mirror of https://github.com/vuejs/vue.git
prepare keep-alive and transition-mode tests
This commit is contained in:
parent
90ee637fd4
commit
7a06a9df3b
|
@ -51,6 +51,9 @@ window.waitForUpdate = initialCb => {
|
||||||
return chainer
|
return chainer
|
||||||
},
|
},
|
||||||
thenWaitFor: (wait) => {
|
thenWaitFor: (wait) => {
|
||||||
|
if (typeof wait === 'number') {
|
||||||
|
wait = timeout(wait)
|
||||||
|
}
|
||||||
wait.wait = true
|
wait.wait = true
|
||||||
queue.push(wait)
|
queue.push(wait)
|
||||||
return chainer
|
return chainer
|
||||||
|
@ -59,3 +62,7 @@ window.waitForUpdate = initialCb => {
|
||||||
|
|
||||||
return chainer
|
return chainer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function timeout (n) {
|
||||||
|
return next => setTimeout(next, n)
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
function insertCSS (text) {
|
||||||
|
var cssEl = document.createElement('style')
|
||||||
|
cssEl.textContent = text.trim()
|
||||||
|
document.head.appendChild(cssEl)
|
||||||
|
}
|
||||||
|
|
||||||
|
const duration = 50
|
||||||
|
let injected = false
|
||||||
|
|
||||||
|
export default function injectStyles () {
|
||||||
|
if (injected) return duration
|
||||||
|
injected = true
|
||||||
|
insertCSS(`
|
||||||
|
.test {
|
||||||
|
-webkit-transition: opacity ${duration}ms ease;
|
||||||
|
transition: opacity ${duration}ms ease;
|
||||||
|
}
|
||||||
|
.v-appear, .v-enter, .v-leave-active,
|
||||||
|
.test-appear, .test-enter, .test-leave-active,
|
||||||
|
.hello, .bye.active,
|
||||||
|
.changed-enter {
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
.test-anim-enter-active {
|
||||||
|
animation: test-enter ${duration}ms;
|
||||||
|
-webkit-animation: test-enter ${duration}ms;
|
||||||
|
}
|
||||||
|
.test-anim-leave-active {
|
||||||
|
animation: test-leave ${duration}ms;
|
||||||
|
-webkit-animation: test-leave ${duration}ms;
|
||||||
|
}
|
||||||
|
@keyframes test-enter {
|
||||||
|
from { opacity: 0 }
|
||||||
|
to { opacity: 1 }
|
||||||
|
}
|
||||||
|
@-webkit-keyframes test-enter {
|
||||||
|
from { opacity: 0 }
|
||||||
|
to { opacity: 1 }
|
||||||
|
}
|
||||||
|
@keyframes test-leave {
|
||||||
|
from { opacity: 1 }
|
||||||
|
to { opacity: 0 }
|
||||||
|
}
|
||||||
|
@-webkit-keyframes test-leave {
|
||||||
|
from { opacity: 1 }
|
||||||
|
to { opacity: 0 }
|
||||||
|
}
|
||||||
|
`)
|
||||||
|
return duration
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
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', () => {
|
||||||
|
it('dynamic components, simultaneous', done => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it('dynamic components, out-in', done => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it('dynamic components, in-out', done => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it('normal elements with different key, simultaneous', done => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it('normal elements with different key, out-in', done => {
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
it('normal elements with different key, in-out', done => {
|
||||||
|
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
|
@ -1,46 +1,11 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
|
import injectStyles from './inject-styles'
|
||||||
import { isIE9 } from 'web/util/index'
|
import { isIE9 } from 'web/util/index'
|
||||||
import { nextFrame } from 'web/runtime/modules/transition'
|
import { nextFrame } from 'web/runtime/modules/transition'
|
||||||
|
|
||||||
if (!isIE9) {
|
if (!isIE9) {
|
||||||
describe('Transition system', () => {
|
describe('Transition system', () => {
|
||||||
const duration = 50
|
const duration = injectStyles()
|
||||||
insertCSS(`
|
|
||||||
.test {
|
|
||||||
-webkit-transition: opacity ${duration}ms ease;
|
|
||||||
transition: opacity ${duration}ms ease;
|
|
||||||
}
|
|
||||||
.v-appear, .v-enter, .v-leave-active,
|
|
||||||
.test-appear, .test-enter, .test-leave-active,
|
|
||||||
.hello, .bye.active,
|
|
||||||
.changed-enter {
|
|
||||||
opacity: 0;
|
|
||||||
}
|
|
||||||
.test-anim-enter-active {
|
|
||||||
animation: test-enter ${duration}ms;
|
|
||||||
-webkit-animation: test-enter ${duration}ms;
|
|
||||||
}
|
|
||||||
.test-anim-leave-active {
|
|
||||||
animation: test-leave ${duration}ms;
|
|
||||||
-webkit-animation: test-leave ${duration}ms;
|
|
||||||
}
|
|
||||||
@keyframes test-enter {
|
|
||||||
from { opacity: 0 }
|
|
||||||
to { opacity: 1 }
|
|
||||||
}
|
|
||||||
@-webkit-keyframes test-enter {
|
|
||||||
from { opacity: 0 }
|
|
||||||
to { opacity: 1 }
|
|
||||||
}
|
|
||||||
@keyframes test-leave {
|
|
||||||
from { opacity: 1 }
|
|
||||||
to { opacity: 0 }
|
|
||||||
}
|
|
||||||
@-webkit-keyframes test-leave {
|
|
||||||
from { opacity: 1 }
|
|
||||||
to { opacity: 0 }
|
|
||||||
}
|
|
||||||
`)
|
|
||||||
|
|
||||||
let el
|
let el
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
|
@ -61,14 +26,14 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-leave')
|
expect(vm.$el.children[0].className).toBe('test v-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-leave-active')
|
expect(vm.$el.children[0].className).toBe('test v-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-enter')
|
expect(vm.$el.children[0].className).toBe('test v-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-enter-active')
|
expect(vm.$el.children[0].className).toBe('test v-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -86,14 +51,14 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave')
|
expect(vm.$el.children[0].className).toBe('test test-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter')
|
expect(vm.$el.children[0].className).toBe('test test-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -119,14 +84,14 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test bye')
|
expect(vm.$el.children[0].className).toBe('test bye')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test bye active')
|
expect(vm.$el.children[0].className).toBe('test bye active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test hello')
|
expect(vm.$el.children[0].className).toBe('test hello')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test hello-active')
|
expect(vm.$el.children[0].className).toBe('test hello-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -147,7 +112,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave')
|
expect(vm.$el.children[0].className).toBe('test test-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
vm.trans = 'changed'
|
vm.trans = 'changed'
|
||||||
|
@ -155,7 +120,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test changed-enter')
|
expect(vm.$el.children[0].className).toBe('test changed-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test changed-enter-active')
|
expect(vm.$el.children[0].className).toBe('test changed-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -188,7 +153,7 @@ if (!isIE9) {
|
||||||
expect(onLeave).toHaveBeenCalled()
|
expect(onLeave).toHaveBeenCalled()
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test bye active')
|
expect(vm.$el.children[0].className).toBe('test bye active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
@ -196,7 +161,7 @@ if (!isIE9) {
|
||||||
expect(onEnter).toHaveBeenCalled()
|
expect(onEnter).toHaveBeenCalled()
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test hello-active')
|
expect(vm.$el.children[0].className).toBe('test hello-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -239,7 +204,7 @@ if (!isIE9) {
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(hooks.afterLeave).not.toHaveBeenCalled()
|
expect(hooks.afterLeave).not.toHaveBeenCalled()
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(hooks.afterLeave).toHaveBeenCalled()
|
expect(hooks.afterLeave).toHaveBeenCalled()
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
|
@ -250,7 +215,7 @@ if (!isIE9) {
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(hooks.afterEnter).not.toHaveBeenCalled()
|
expect(hooks.afterEnter).not.toHaveBeenCalled()
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(hooks.afterEnter).toHaveBeenCalled()
|
expect(hooks.afterEnter).toHaveBeenCalled()
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
|
@ -277,7 +242,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave')
|
expect(vm.$el.children[0].className).toBe('test test-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
expect(next).toBeTruthy()
|
expect(next).toBeTruthy()
|
||||||
next()
|
next()
|
||||||
|
@ -288,7 +253,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter')
|
expect(vm.$el.children[0].className).toBe('test test-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
expect(next).toBeTruthy()
|
expect(next).toBeTruthy()
|
||||||
next()
|
next()
|
||||||
|
@ -367,14 +332,14 @@ if (!isIE9) {
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
waitForUpdate(() => {
|
waitForUpdate(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter')
|
expect(vm.$el.children[0].className).toBe('test test-enter')
|
||||||
}).thenWaitFor(timeout(duration / 2)).then(() => {
|
}).thenWaitFor(duration / 2).then(() => {
|
||||||
vm.ok = false
|
vm.ok = false
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(spy).toHaveBeenCalled()
|
expect(spy).toHaveBeenCalled()
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave')
|
expect(vm.$el.children[0].className).toBe('test test-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -393,7 +358,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave')
|
expect(vm.$el.children[0].className).toBe('test test-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].style.display).toBe('none')
|
expect(vm.$el.children[0].style.display).toBe('none')
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
|
@ -401,7 +366,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter')
|
expect(vm.$el.children[0].className).toBe('test test-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -424,14 +389,14 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave')
|
expect(vm.$el.children[0].className).toBe('test test-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-leave-active')
|
||||||
}).thenWaitFor(timeout(duration / 2)).then(() => {
|
}).thenWaitFor(duration / 2).then(() => {
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(spy).toHaveBeenCalled()
|
expect(spy).toHaveBeenCalled()
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter')
|
expect(vm.$el.children[0].className).toBe('test test-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].style.display).toBe('')
|
expect(vm.$el.children[0].style.display).toBe('')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -449,14 +414,14 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-anim-leave')
|
expect(vm.$el.children[0].className).toBe('test test-anim-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-anim-leave-active')
|
expect(vm.$el.children[0].className).toBe('test test-anim-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-anim-enter')
|
expect(vm.$el.children[0].className).toBe('test test-anim-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-anim-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-anim-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -482,7 +447,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-appear')
|
expect(vm.$el.children[0].className).toBe('test test-appear')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-appear-active')
|
expect(vm.$el.children[0].className).toBe('test test-appear-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -503,7 +468,7 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter')
|
expect(vm.$el.children[0].className).toBe('test test-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
expect(vm.$el.children[0].className).toBe('test test-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -521,14 +486,14 @@ if (!isIE9) {
|
||||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave')
|
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave-active')
|
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.childNodes.length).toBe(0)
|
expect(vm.$el.childNodes.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-enter')
|
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-enter-active')
|
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test')
|
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
|
@ -551,26 +516,16 @@ if (!isIE9) {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-leave')
|
expect(vm.$el.children[0].className).toBe('test v-leave')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-leave-active')
|
expect(vm.$el.children[0].className).toBe('test v-leave-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children.length).toBe(0)
|
expect(vm.$el.children.length).toBe(0)
|
||||||
vm.ok = true
|
vm.ok = true
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-enter')
|
expect(vm.$el.children[0].className).toBe('test v-enter')
|
||||||
}).thenWaitFor(nextFrame).then(() => {
|
}).thenWaitFor(nextFrame).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test v-enter-active')
|
expect(vm.$el.children[0].className).toBe('test v-enter-active')
|
||||||
}).thenWaitFor(timeout(duration + 10)).then(() => {
|
}).thenWaitFor(duration + 10).then(() => {
|
||||||
expect(vm.$el.children[0].className).toBe('test')
|
expect(vm.$el.children[0].className).toBe('test')
|
||||||
}).then(done)
|
}).then(done)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function insertCSS (text) {
|
|
||||||
var cssEl = document.createElement('style')
|
|
||||||
cssEl.textContent = text.trim()
|
|
||||||
document.head.appendChild(cssEl)
|
|
||||||
}
|
|
||||||
|
|
||||||
function timeout (n) {
|
|
||||||
return next => setTimeout(next, n)
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue