@@ -3325,7 +3325,77 @@ describe('Vapor Mode hydration', () => {
3325
3325
expect ( teleportContainer . innerHTML ) . toBe ( '' )
3326
3326
} )
3327
3327
3328
- test ( 'unmount (mismatch + full integration)' , async ( ) => { } )
3328
+ // TODO: need merge mismatch handling code from #13226
3329
+ test . todo ( 'unmount (mismatch + full integration)' , async ( ) => {
3330
+ const targetId = 'teleport7'
3331
+ const data = ref ( {
3332
+ toggle : ref ( true ) ,
3333
+ } )
3334
+
3335
+ const template1 = `<Teleport to="#${ targetId } "><span>Teleported Comp1</span></Teleport>`
3336
+ const Comp1 = compileVaporComponent ( template1 )
3337
+ const SSRComp1 = compileVaporComponent (
3338
+ template1 ,
3339
+ undefined ,
3340
+ undefined ,
3341
+ true ,
3342
+ )
3343
+
3344
+ const template2 = `<div>Comp2</div>`
3345
+ const Comp2 = compileVaporComponent ( template2 )
3346
+ const SSRComp2 = compileVaporComponent (
3347
+ template2 ,
3348
+ undefined ,
3349
+ undefined ,
3350
+ true ,
3351
+ )
3352
+
3353
+ const appCode = `
3354
+ <div>
3355
+ <components.Comp1 v-if="data.toggle"/>
3356
+ <components.Comp2 v-else/>
3357
+ </div>
3358
+ `
3359
+
3360
+ const SSRApp = compileVaporComponent (
3361
+ appCode ,
3362
+ data ,
3363
+ {
3364
+ Comp1 : SSRComp1 ,
3365
+ Comp2 : SSRComp2 ,
3366
+ } ,
3367
+ true ,
3368
+ )
3369
+
3370
+ const teleportContainer = document . createElement ( 'div' )
3371
+ teleportContainer . id = targetId
3372
+ document . body . appendChild ( teleportContainer )
3373
+
3374
+ const mainHtml = await VueServerRenderer . renderToString (
3375
+ runtimeDom . createSSRApp ( SSRApp ) ,
3376
+ )
3377
+ expect ( mainHtml ) . toBe (
3378
+ '<div><!--teleport start--><!--teleport end--></div>' ,
3379
+ )
3380
+ // teleportContainer.innerHTML =
3381
+ expect ( teleportContainer . innerHTML ) . toBe ( '' )
3382
+
3383
+ const { container } = await mountWithHydration ( mainHtml , appCode , data , {
3384
+ Comp1,
3385
+ Comp2,
3386
+ } )
3387
+
3388
+ expect ( container . innerHTML ) . toBe (
3389
+ '<div><!--teleport start--><!--teleport end--><!--if--></div>' ,
3390
+ )
3391
+ expect ( teleportContainer . innerHTML ) . toBe ( `<span>Teleported Comp1</span>` )
3392
+ expect ( `mismatch` ) . toHaveBeenWarned ( )
3393
+
3394
+ data . value . toggle = false
3395
+ await nextTick ( )
3396
+ expect ( container . innerHTML ) . toBe ( '<div><div>Comp2</div><!--if--></div>' )
3397
+ expect ( teleportContainer . innerHTML ) . toBe ( '' )
3398
+ } )
3329
3399
3330
3400
test ( 'target change (mismatch + full integration)' , async ( ) => { } )
3331
3401
} )
0 commit comments