@@ -1586,6 +1586,72 @@ describe('e2e: Transition', () => {
1586
1586
expect ( barMountSpy ) . toBeCalledTimes ( 1 )
1587
1587
expect ( barMountSpy ) . toHaveBeenNthCalledWith ( 1 , true , false , true )
1588
1588
} )
1589
+
1590
+ // #8105
1591
+ test (
1592
+ 'trigger again when transition is not finished' ,
1593
+ async ( ) => {
1594
+ await page ( ) . evaluate ( duration => {
1595
+ const { createApp, shallowRef, h } = ( window as any ) . Vue
1596
+ const One = {
1597
+ async setup ( ) {
1598
+ return ( ) => h ( 'div' , { class : 'test' } , 'one' )
1599
+ }
1600
+ }
1601
+ const Two = {
1602
+ async setup ( ) {
1603
+ return ( ) => h ( 'div' , { class : 'test' } , 'two' )
1604
+ }
1605
+ }
1606
+ createApp ( {
1607
+ template : `
1608
+ <div id="container">
1609
+ <transition name="test" mode="out-in" duration="${ duration } ">
1610
+ <Suspense>
1611
+ <component :is="view"/>
1612
+ </Suspense>
1613
+ </transition>
1614
+ </div>
1615
+ <button id="toggleBtn" @click="click">button</button>
1616
+ ` ,
1617
+ setup : ( ) => {
1618
+ const view = shallowRef ( One )
1619
+ const click = ( ) => {
1620
+ view . value = view . value === One ? Two : One
1621
+ }
1622
+ return { view, click }
1623
+ }
1624
+ } ) . mount ( '#app' )
1625
+ } , duration )
1626
+
1627
+ await nextFrame ( )
1628
+ expect ( await html ( '#container' ) ) . toBe (
1629
+ '<div class="test test-enter-active test-enter-to">one</div>'
1630
+ )
1631
+
1632
+ await transitionFinish ( )
1633
+ expect ( await html ( '#container' ) ) . toBe ( '<div class="test">one</div>' )
1634
+
1635
+ // trigger twice
1636
+ classWhenTransitionStart ( )
1637
+ classWhenTransitionStart ( )
1638
+ await nextFrame ( )
1639
+ expect ( await html ( '#container' ) ) . toBe (
1640
+ '<div class="test test-leave-active test-leave-to">one</div>'
1641
+ )
1642
+
1643
+ await transitionFinish ( )
1644
+ await nextFrame ( )
1645
+ expect ( await html ( '#container' ) ) . toBe (
1646
+ '<div class="test test-enter-active test-enter-to">one</div>'
1647
+ )
1648
+
1649
+ await transitionFinish ( )
1650
+ await nextFrame ( )
1651
+ expect ( await html ( '#container' ) ) . toBe ( '<div class="test">one</div>' )
1652
+ } ,
1653
+ E2E_TIMEOUT
1654
+ )
1589
1655
} )
1590
1656
1591
1657
describe ( 'transition with v-show' , ( ) => {
0 commit comments