|
|
@@ -1586,6 +1586,72 @@ describe('e2e: Transition', () => {
|
|
|
expect(barMountSpy).toBeCalledTimes(1)
|
|
|
expect(barMountSpy).toHaveBeenNthCalledWith(1, true, false, true)
|
|
|
})
|
|
|
+
|
|
|
+ // #8105
|
|
|
+ test(
|
|
|
+ 'trigger again when transition is not finished',
|
|
|
+ async () => {
|
|
|
+ await page().evaluate(duration => {
|
|
|
+ const { createApp, shallowRef, h } = (window as any).Vue
|
|
|
+ const One = {
|
|
|
+ async setup() {
|
|
|
+ return () => h('div', { class: 'test' }, 'one')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ const Two = {
|
|
|
+ async setup() {
|
|
|
+ return () => h('div', { class: 'test' }, 'two')
|
|
|
+ }
|
|
|
+ }
|
|
|
+ createApp({
|
|
|
+ template: `
|
|
|
+ <div id="container">
|
|
|
+ <transition name="test" mode="out-in" duration="${duration}">
|
|
|
+ <Suspense>
|
|
|
+ <component :is="view"/>
|
|
|
+ </Suspense>
|
|
|
+ </transition>
|
|
|
+ </div>
|
|
|
+ <button id="toggleBtn" @click="click">button</button>
|
|
|
+ `,
|
|
|
+ setup: () => {
|
|
|
+ const view = shallowRef(One)
|
|
|
+ const click = () => {
|
|
|
+ view.value = view.value === One ? Two : One
|
|
|
+ }
|
|
|
+ return { view, click }
|
|
|
+ }
|
|
|
+ }).mount('#app')
|
|
|
+ }, duration)
|
|
|
+
|
|
|
+ await nextFrame()
|
|
|
+ expect(await html('#container')).toBe(
|
|
|
+ '<div class="test test-enter-active test-enter-to">one</div>'
|
|
|
+ )
|
|
|
+
|
|
|
+ await transitionFinish()
|
|
|
+ expect(await html('#container')).toBe('<div class="test">one</div>')
|
|
|
+
|
|
|
+ // trigger twice
|
|
|
+ classWhenTransitionStart()
|
|
|
+ classWhenTransitionStart()
|
|
|
+ await nextFrame()
|
|
|
+ expect(await html('#container')).toBe(
|
|
|
+ '<div class="test test-leave-active test-leave-to">one</div>'
|
|
|
+ )
|
|
|
+
|
|
|
+ await transitionFinish()
|
|
|
+ await nextFrame()
|
|
|
+ expect(await html('#container')).toBe(
|
|
|
+ '<div class="test test-enter-active test-enter-to">one</div>'
|
|
|
+ )
|
|
|
+
|
|
|
+ await transitionFinish()
|
|
|
+ await nextFrame()
|
|
|
+ expect(await html('#container')).toBe('<div class="test">one</div>')
|
|
|
+ },
|
|
|
+ E2E_TIMEOUT
|
|
|
+ )
|
|
|
})
|
|
|
|
|
|
describe('transition with v-show', () => {
|