mirror of
https://gitee.com/vuejs/vue.git
synced 2024-12-03 12:38:24 +08:00
test: remove global before waitForUpdate
This commit is contained in:
parent
52627b95ce
commit
63e7d59a03
@ -60,7 +60,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('two')
|
||||
assertHookCalls(one, [1, 1, 1, 1, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 0, 0])
|
||||
@ -104,7 +104,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 0, 0])
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('')
|
||||
assertHookCalls(one, [1, 1, 1, 1, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 1, 0])
|
||||
@ -145,7 +145,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 0, 0])
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('')
|
||||
assertHookCalls(one, [1, 1, 1, 1, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 1, 0])
|
||||
@ -214,7 +214,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('two')
|
||||
assertHookCalls(one, [1, 1, 1, 1, 0])
|
||||
assertHookCalls(two, [1, 1, 0, 0, 0])
|
||||
@ -379,7 +379,7 @@ describe('Component keep-alive', () => {
|
||||
}).$mount()
|
||||
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
assertHookCalls(one, [1, 1, 1, 1, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 0, 0])
|
||||
vm.include = 'two'
|
||||
@ -410,7 +410,7 @@ describe('Component keep-alive', () => {
|
||||
}).$mount()
|
||||
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
assertHookCalls(one, [1, 1, 1, 1, 0])
|
||||
assertHookCalls(two, [1, 1, 1, 0, 0])
|
||||
vm.include = 'one'
|
||||
@ -439,7 +439,7 @@ describe('Component keep-alive', () => {
|
||||
}).$mount()
|
||||
|
||||
vm.include = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
vm.view = 'two'
|
||||
@ -468,7 +468,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(two, [1, 1, 1, 0, 0])
|
||||
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
assertHookCalls(one, [1, 1, 1, 1, 1])
|
||||
assertHookCalls(two, [1, 1, 1, 1, 1])
|
||||
}).then(done)
|
||||
@ -498,7 +498,7 @@ describe('Component keep-alive', () => {
|
||||
|
||||
expect(vm.$el.textContent).toBe('one 1')
|
||||
vm.n++
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('one 2')
|
||||
vm.view = 'two'
|
||||
}).then(() => {
|
||||
@ -555,7 +555,7 @@ describe('Component keep-alive', () => {
|
||||
|
||||
assertCount([1, 0, 0, 0, 0, 0])
|
||||
vm.n = 'bb'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
assertCount([1, 0, 1, 0, 0, 0])
|
||||
vm.n = 'cc'
|
||||
}).then(() => {
|
||||
@ -621,7 +621,7 @@ describe('Component keep-alive', () => {
|
||||
|
||||
assertCount([1, 0, 0, 0, 0, 0])
|
||||
vm.n = 'bb'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
// should prune A because max cache reached
|
||||
assertCount([1, 1, 1, 0, 0, 0])
|
||||
vm.n = 'cc'
|
||||
@ -686,7 +686,7 @@ describe('Component keep-alive', () => {
|
||||
expect(vm.$el.textContent).toBe('foo')
|
||||
assert(1, 0)
|
||||
vm.view = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('bar')
|
||||
assert(1, 1)
|
||||
vm.view = true
|
||||
@ -738,7 +738,7 @@ describe('Component keep-alive', () => {
|
||||
expect(vm.$el.textContent).toBe('foo')
|
||||
assert(1, 0)
|
||||
vm.view = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('bar')
|
||||
assert(1, 1)
|
||||
vm.view = true
|
||||
@ -773,7 +773,7 @@ describe('Component keep-alive', () => {
|
||||
}).$mount()
|
||||
// condition: a render where a previous component is reused
|
||||
vm.include = ['foo']
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
vm.include = ['']
|
||||
}).then(() => {
|
||||
expect(Foo.destroyed).not.toHaveBeenCalled()
|
||||
@ -805,7 +805,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(
|
||||
'<div class="test test-leave test-leave-active">one</div><!---->'
|
||||
)
|
||||
@ -890,7 +890,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(
|
||||
'<div class="test test-leave test-leave-active">one</div><!---->'
|
||||
)
|
||||
@ -975,7 +975,7 @@ describe('Component keep-alive', () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(
|
||||
'<div class="test">one</div>' +
|
||||
'<div class="test test-enter test-enter-active">two</div>'
|
||||
@ -1066,7 +1066,7 @@ describe('Component keep-alive', () => {
|
||||
}).$mount(el)
|
||||
expect(vm.$el.textContent).toBe('one')
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(
|
||||
'<div class="test">one</div>' +
|
||||
'<div class="test test-enter test-enter-active">two</div>'
|
||||
@ -1134,7 +1134,7 @@ describe('Component keep-alive', () => {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.view = 'bar'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(
|
||||
'<div class="test v-leave v-leave-active">foo</div>' +
|
||||
'<div class="test test-enter test-enter-active">bar</div>'
|
||||
@ -1210,7 +1210,7 @@ describe('Component keep-alive', () => {
|
||||
next = () => {
|
||||
assertHookCalls(one, [1, 1, 1, 0, 0])
|
||||
assertHookCalls(two, [0, 0, 0, 0, 0])
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(
|
||||
'<div class="test test-enter test-enter-active">one</div>'
|
||||
)
|
||||
@ -1274,7 +1274,7 @@ describe('Component keep-alive', () => {
|
||||
btn.click()
|
||||
expect(vm.n).toBe(1)
|
||||
vm.showBtn = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
vm.showBtn = true
|
||||
}).then(() => {
|
||||
btn.click()
|
||||
|
@ -218,7 +218,7 @@ describe('Component slot', () => {
|
||||
}).$mount()
|
||||
expect(vm.$el.textContent).toBe('12')
|
||||
vm.a = 2
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('22')
|
||||
vm.show = false
|
||||
}).then(() => {
|
||||
@ -255,7 +255,7 @@ describe('Component slot', () => {
|
||||
}).$mount()
|
||||
expect(vm.$el.innerHTML).toBe('<div><p>foo</p></div>')
|
||||
vm.msg = 'bar'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe('<div><p>bar</p></div>')
|
||||
}).then(done)
|
||||
})
|
||||
@ -275,7 +275,7 @@ describe('Component slot', () => {
|
||||
}).$mount()
|
||||
expect(vm.$el.innerHTML).toBe('<p>hi</p>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe('fallback')
|
||||
vm.ok = true
|
||||
vm.msg = 'bye'
|
||||
@ -475,7 +475,7 @@ describe('Component slot', () => {
|
||||
}).$mount()
|
||||
expect(vm.$el.textContent).toBe('foo1')
|
||||
vm.$children[0].a = 2
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.textContent).toBe('foo2')
|
||||
}).then(done)
|
||||
})
|
||||
@ -512,7 +512,7 @@ describe('Component slot', () => {
|
||||
|
||||
expect(calls).toEqual([1])
|
||||
vm.$refs.child.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(calls).toEqual([1, 2])
|
||||
vm.$refs.child.ok = true
|
||||
}).then(() => {
|
||||
@ -550,7 +550,7 @@ describe('Component slot', () => {
|
||||
}).$mount()
|
||||
expect(vm.$el.innerHTML).toBe(`<div>1</div> <div>1</div> <pre><div>1</div></pre>`)
|
||||
vm.n++
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe(`<div>2</div> <div>2</div> <pre><div>2</div></pre>`)
|
||||
vm.n++
|
||||
}).then(() => {
|
||||
@ -586,7 +586,7 @@ describe('Component slot', () => {
|
||||
document.body.appendChild(vm.$el)
|
||||
expect(vm.$el.textContent).toBe('hi')
|
||||
vm.$children[0].toggle = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
vm.$children[0].toggle = true
|
||||
}).then(() => {
|
||||
global.triggerEvent(vm.$el.querySelector('.click'), 'click')
|
||||
|
@ -32,7 +32,7 @@ describe('Error handling', () => {
|
||||
].forEach(([type, description]) => {
|
||||
it(`should recover from promise errors in ${type}`, done => {
|
||||
createTestInstance(components[`${type}Async`])
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(`Error in ${description} (Promise/async)`).toHaveBeenWarned()
|
||||
expect(`Error: ${type}`).toHaveBeenWarned()
|
||||
}).then(done)
|
||||
@ -84,7 +84,7 @@ describe('Error handling', () => {
|
||||
it(`should recover from errors in ${type} hook`, done => {
|
||||
const vm = createTestInstance(components[type])
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(`Error in ${description}`).toHaveBeenWarned()
|
||||
expect(`Error: ${type}`).toHaveBeenWarned()
|
||||
}).thenWaitFor(next => {
|
||||
@ -111,7 +111,7 @@ describe('Error handling', () => {
|
||||
it('should recover from errors in user watcher getter', done => {
|
||||
const vm = createTestInstance(components.userWatcherGetter)
|
||||
vm.n++
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(`Error in getter for watcher`).toHaveBeenWarned()
|
||||
function getErrorMsg () {
|
||||
try {
|
||||
@ -226,7 +226,7 @@ describe('Error handling', () => {
|
||||
}).$mount()
|
||||
document.body.appendChild(vm.$el)
|
||||
global.triggerEvent(vm.$el, 'click')
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect('Error in v-on handler (Promise/async)').toHaveBeenWarned()
|
||||
expect('Error: v-on').toHaveBeenWarned()
|
||||
document.body.removeChild(vm.$el)
|
||||
@ -435,14 +435,14 @@ function createTestInstance (Comp) {
|
||||
function assertRootInstanceActive (vm) {
|
||||
expect(vm.$el.innerHTML).toContain('n:0\n')
|
||||
vm.n++
|
||||
return global.waitForUpdate(() => {
|
||||
return waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toContain('n:1\n')
|
||||
})
|
||||
}
|
||||
|
||||
function assertBothInstancesActive (vm) {
|
||||
vm.n = 0
|
||||
return global.waitForUpdate(() => {
|
||||
return waitForUpdate(() => {
|
||||
expect(vm.$refs.child.$el.innerHTML).toContain('0')
|
||||
}).thenWaitFor(next => {
|
||||
assertRootInstanceActive(vm).then(() => {
|
||||
|
@ -48,7 +48,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -85,7 +85,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test bye byebye active more')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test byebye active more bye-to')
|
||||
@ -119,7 +119,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -165,7 +165,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test bye byebye active')
|
||||
expect(leave).toHaveBeenCalled()
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
@ -233,7 +233,7 @@ if (!isIE9) {
|
||||
|
||||
let _el = vm.$el.children[0]
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(beforeLeaveSpy).toHaveBeenCalledWith(_el)
|
||||
expect(onLeaveSpy).toHaveBeenCalledWith(_el)
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
@ -318,7 +318,7 @@ if (!isIE9) {
|
||||
|
||||
let _el = vm.$el.children[0]
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(beforeLeaveSpy).toHaveBeenCalledWith(_el)
|
||||
expect(onLeaveSpy).toHaveBeenCalledWith(_el)
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
@ -362,7 +362,7 @@ if (!isIE9) {
|
||||
}
|
||||
}).$mount(el)
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -404,7 +404,7 @@ if (!isIE9) {
|
||||
}).$mount(el)
|
||||
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(leaveSpy).toHaveBeenCalled()
|
||||
expect(vm.$el.innerHTML).toBe('<!---->')
|
||||
vm.ok = true
|
||||
@ -427,7 +427,7 @@ if (!isIE9) {
|
||||
}).$mount(el)
|
||||
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(leaveSpy).toHaveBeenCalled()
|
||||
expect(vm.$el.innerHTML).toBe('<div class="nope-leave nope-leave-active">foo</div><!---->')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
@ -459,7 +459,7 @@ if (!isIE9) {
|
||||
|
||||
expect(vm.$el.innerHTML).toBe('<!---->')
|
||||
vm.ok = true
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-enter-active test-enter-to')
|
||||
@ -493,7 +493,7 @@ if (!isIE9) {
|
||||
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(duration / 2).then(() => {
|
||||
vm.ok = true
|
||||
@ -525,7 +525,7 @@ if (!isIE9) {
|
||||
expect(vm.$el.children[0].style.display).toBe('')
|
||||
expect(vm.$el.children[0].className).toBe('test')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -561,7 +561,7 @@ if (!isIE9) {
|
||||
expect(vm.$el.textContent).toBe('foo')
|
||||
expect(vm.$el.children[0].style.display).toBe('')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -596,7 +596,7 @@ if (!isIE9) {
|
||||
|
||||
expect(vm.$el.children[0].style.display).toBe('')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -625,7 +625,7 @@ if (!isIE9) {
|
||||
}).$mount(el)
|
||||
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
vm.ok = true
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-enter-active test-enter-to')
|
||||
@ -647,7 +647,7 @@ if (!isIE9) {
|
||||
}).$mount(el)
|
||||
|
||||
vm.ok = true
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
vm.ok = false
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -671,7 +671,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div>foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test-anim-leave test-anim-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test-anim-leave-active test-anim-leave-to')
|
||||
@ -702,7 +702,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-anim-long-leave test-anim-long-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-anim-long-leave-active test-anim-long-leave-to')
|
||||
@ -739,7 +739,7 @@ if (!isIE9) {
|
||||
data: { ok: true }
|
||||
}).$mount(el)
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-appear test-appear-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-appear-active test-appear-to')
|
||||
@ -760,7 +760,7 @@ if (!isIE9) {
|
||||
data: { ok: true }
|
||||
}).$mount(el)
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-enter test-enter-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-enter-active test-enter-to')
|
||||
@ -784,7 +784,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.childNodes[0].getAttribute('class')).toBe('test v-leave-active v-leave-to')
|
||||
@ -826,7 +826,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -864,7 +864,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -898,7 +898,7 @@ if (!isIE9) {
|
||||
}
|
||||
}).$mount(el)
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-appear test-appear-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-appear-active test-appear-to')
|
||||
@ -937,7 +937,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -976,7 +976,7 @@ if (!isIE9) {
|
||||
}
|
||||
}).$mount(el)
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-appear test-appear-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-appear-active test-appear-to')
|
||||
@ -1010,7 +1010,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test">foo</div>')
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave test-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test test-leave-active test-leave-to')
|
||||
@ -1048,7 +1048,7 @@ if (!isIE9) {
|
||||
|
||||
vm.ok = false
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -1078,7 +1078,7 @@ if (!isIE9) {
|
||||
|
||||
vm.ok = false
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -1108,7 +1108,7 @@ if (!isIE9) {
|
||||
|
||||
vm.ok = false
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -1141,7 +1141,7 @@ if (!isIE9) {
|
||||
|
||||
vm.ok = false
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -1180,7 +1180,7 @@ if (!isIE9) {
|
||||
|
||||
vm.ok = false
|
||||
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave v-leave-active')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-leave-active v-leave-to')
|
||||
@ -1228,7 +1228,7 @@ if (!isIE9) {
|
||||
}).$mount(el)
|
||||
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(`<transition> explicit leave duration is not a valid number - got "foo"`).toHaveBeenWarned()
|
||||
}).thenWaitFor(duration + buffer).then(() => {
|
||||
vm.ok = true
|
||||
@ -1262,7 +1262,7 @@ if (!isIE9) {
|
||||
// should not apply transition on initial render by default
|
||||
expect(vm.$el.innerHTML).toBe('<!---->')
|
||||
vm.view = 'two'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.innerHTML).toBe('<div class="test v-enter v-enter-active">two</div>')
|
||||
}).thenWaitFor(nextFrame).then(() => {
|
||||
expect(vm.$el.children[0].className).toBe('test v-enter-active v-enter-to')
|
||||
@ -1297,7 +1297,7 @@ if (!isIE9) {
|
||||
}).$mount(el)
|
||||
|
||||
vm.ok = false
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.children[0].innerHTML).toBe('false')
|
||||
}).then(done)
|
||||
})
|
||||
|
@ -80,7 +80,7 @@ describe('vdom domProps module', () => {
|
||||
|
||||
expect(vm.$el.id).toBe('foo')
|
||||
vm.props.id = 'bar'
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vm.$el.id).toBe('bar')
|
||||
vm.props = { id: 'baz' }
|
||||
}).then(() => {
|
||||
|
@ -48,7 +48,7 @@ describe('vdom patch: edge cases', () => {
|
||||
directives: {
|
||||
test: {
|
||||
bind (el, binding, vnode) {
|
||||
global.waitForUpdate(() => {
|
||||
waitForUpdate(() => {
|
||||
expect(vnode.children[0].data.on.click()).toBe(5)
|
||||
expect(vnode.children[2].data.on.click(dummyEvt)).toBe(5)
|
||||
expect(vnode.children[4].data.on.click()).toBe(10)
|
||||
|
Loading…
Reference in New Issue
Block a user