@@ -1097,6 +1097,89 @@ describe('e2e: Transition', () => {
1097
1097
} ,
1098
1098
E2E_TIMEOUT
1099
1099
)
1100
+
1101
+ //#4933
1102
+ test (
1103
+ '(out-in mode) transition on child components with empty root node' ,
1104
+ async ( ) => {
1105
+ await page ( ) . evaluate ( ( ) => {
1106
+ const { createApp, ref, computed } = ( window as any ) . Vue
1107
+ createApp ( {
1108
+ template : `
1109
+ <div id="container">
1110
+ <transition name="test" mode="out-in">
1111
+ <component class="test" :is="view" :key="key"></component>
1112
+ </transition>
1113
+ </div>
1114
+ <button id="toggleBtn" @click="change">button</button>
1115
+ ` ,
1116
+ components : {
1117
+ one : {
1118
+ template : '<div v-if="false">one</div>'
1119
+ } ,
1120
+ two : {
1121
+ template : '<div v-if="true">two</div>'
1122
+ }
1123
+ } ,
1124
+ setup : ( ) => {
1125
+ const toggle = ref ( true )
1126
+ const view = ref ( 'two' )
1127
+ const key = computed ( ( ) => ( view . value === 'one' ? 'one' : 'two' ) )
1128
+ const change = ( ) =>
1129
+ ( view . value = view . value === 'one' ? 'two' : 'one' )
1130
+ return { toggle, change, view, key }
1131
+ }
1132
+ } ) . mount ( '#app' )
1133
+ } )
1134
+ expect ( await html ( '#container' ) ) . toBe ( '<div class="test">two</div>' )
1135
+
1136
+ // two -> one
1137
+ expect ( await classWhenTransitionStart ( ) ) . toStrictEqual ( [
1138
+ 'test' ,
1139
+ 'test-leave-from' ,
1140
+ 'test-leave-active'
1141
+ ] )
1142
+ await nextFrame ( )
1143
+ expect ( await classList ( '.test' ) ) . toStrictEqual ( [
1144
+ 'test' ,
1145
+ 'test-leave-active' ,
1146
+ 'test-leave-to'
1147
+ ] )
1148
+ await transitionFinish ( )
1149
+ expect ( await html ( '#container' ) ) . toBe ( '<!--v-if-->' )
1150
+
1151
+ // one -> two
1152
+ expect ( await classWhenTransitionStart ( ) ) . toStrictEqual ( [
1153
+ 'test' ,
1154
+ 'test-enter-from' ,
1155
+ 'test-enter-active'
1156
+ ] )
1157
+ await nextFrame ( )
1158
+ expect ( await classList ( '.test' ) ) . toStrictEqual ( [
1159
+ 'test' ,
1160
+ 'test-enter-active' ,
1161
+ 'test-enter-to'
1162
+ ] )
1163
+ await transitionFinish ( )
1164
+ expect ( await html ( '#container' ) ) . toBe ( '<div class="test">two</div>' )
1165
+
1166
+ // two -> one again
1167
+ expect ( await classWhenTransitionStart ( ) ) . toStrictEqual ( [
1168
+ 'test' ,
1169
+ 'test-leave-from' ,
1170
+ 'test-leave-active'
1171
+ ] )
1172
+ await nextFrame ( )
1173
+ expect ( await classList ( '.test' ) ) . toStrictEqual ( [
1174
+ 'test' ,
1175
+ 'test-leave-active' ,
1176
+ 'test-leave-to'
1177
+ ] )
1178
+ await transitionFinish ( )
1179
+ expect ( await html ( '#container' ) ) . toBe ( '<!--v-if-->' )
1180
+ } ,
1181
+ E2E_TIMEOUT
1182
+ )
1100
1183
} )
1101
1184
1102
1185
describe ( 'transition with Suspense' , ( ) => {
0 commit comments