@@ -264,7 +264,7 @@ describe('Vapor Mode hydration', () => {
264
264
)
265
265
} )
266
266
267
- test ( 'consecutive component with anchor insertion' , async ( ) => {
267
+ test ( 'consecutive components with anchor insertion' , async ( ) => {
268
268
const { container, data } = await testHydration (
269
269
`<template>
270
270
<div>
@@ -344,6 +344,111 @@ describe('Vapor Mode hydration', () => {
344
344
)
345
345
} )
346
346
347
+ test ( 'fragment component with anchor insertion' , async ( ) => {
348
+ const { container, data } = await testHydration (
349
+ `<template>
350
+ <div>
351
+ <span/>
352
+ <components.Child/>
353
+ <span/>
354
+ </div>
355
+ </template>
356
+ ` ,
357
+ {
358
+ Child : `<template><div>{{ data }}</div>-{{ data }}</template>` ,
359
+ } ,
360
+ )
361
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
362
+ `"<div><span></span><!--[--><div>foo</div>-foo<!--]--><span></span></div>"` ,
363
+ )
364
+
365
+ data . value = 'bar'
366
+ await nextTick ( )
367
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
368
+ `"<div><span></span><!--[--><div>bar</div>-bar<!--]--><span></span></div>"` ,
369
+ )
370
+ } )
371
+
372
+ test ( 'consecutive fragment components with anchor insertion' , async ( ) => {
373
+ const { container, data } = await testHydration (
374
+ `<template>
375
+ <div>
376
+ <span/>
377
+ <components.Child/>
378
+ <components.Child/>
379
+ <span/>
380
+ </div>
381
+ </template>
382
+ ` ,
383
+ {
384
+ Child : `<template><div>{{ data }}</div>-{{ data }}</template>` ,
385
+ } ,
386
+ )
387
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
388
+ `"<div><span></span><!--[[--><!--[--><div>foo</div>-foo<!--]--><!--]]--><!--[[--><!--[--><div>foo</div>-foo<!--]--><!--]]--><span></span></div>"` ,
389
+ )
390
+
391
+ data . value = 'bar'
392
+ await nextTick ( )
393
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
394
+ `"<div><span></span><!--[[--><!--[--><div>bar</div>-bar<!--]--><!--]]--><!--[[--><!--[--><div>bar</div>-bar<!--]--><!--]]--><span></span></div>"` ,
395
+ )
396
+ } )
397
+
398
+ test ( 'mixed fragment component and element with anchor insertion' , async ( ) => {
399
+ const { container, data } = await testHydration (
400
+ `<template>
401
+ <div>
402
+ <span/>
403
+ <components.Child/>
404
+ <span/>
405
+ <components.Child/>
406
+ <span/>
407
+ </div>
408
+ </template>
409
+ ` ,
410
+ {
411
+ Child : `<template><div>{{ data }}</div>-{{ data }}</template>` ,
412
+ } ,
413
+ )
414
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
415
+ `"<div><span></span><!--[--><div>foo</div>-foo<!--]--><span></span><!--[--><div>foo</div>-foo<!--]--><span></span></div>"` ,
416
+ )
417
+
418
+ data . value = 'bar'
419
+ await nextTick ( )
420
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
421
+ `"<div><span></span><!--[--><div>bar</div>-bar<!--]--><span></span><!--[--><div>bar</div>-bar<!--]--><span></span></div>"` ,
422
+ )
423
+ } )
424
+
425
+ test ( 'mixed fragment component and text with anchor insertion' , async ( ) => {
426
+ const { container, data } = await testHydration (
427
+ `<template>
428
+ <div>
429
+ <span/>
430
+ <components.Child/>
431
+ {{ data }}
432
+ <components.Child/>
433
+ <span/>
434
+ </div>
435
+ </template>
436
+ ` ,
437
+ {
438
+ Child : `<template><div>{{ data }}</div>-{{ data }}</template>` ,
439
+ } ,
440
+ )
441
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
442
+ `"<div><span></span><!--[[--><!--[--><div>foo</div>-foo<!--]--><!--]]--><!--[[--> <!--]]--><!--[[--> foo <!--]]--><!--[[--> <!--]]--><!--[[--><!--[--><div>foo</div>-foo<!--]--><!--]]--><span></span></div>"` ,
443
+ )
444
+
445
+ data . value = 'bar'
446
+ await nextTick ( )
447
+ expect ( container . innerHTML ) . toMatchInlineSnapshot (
448
+ `"<div><span></span><!--[[--><!--[--><div>bar</div>-bar<!--]--><!--]]--><!--[[--> <!--]]--><!--[[--> bar <!--]]--><!--[[--> <!--]]--><!--[[--><!--[--><div>bar</div>-bar<!--]--><!--]]--><span></span></div>"` ,
449
+ )
450
+ } )
451
+
347
452
test . todo ( 'if' )
348
453
349
454
test . todo ( 'for' )
0 commit comments