@@ -27,6 +27,8 @@ import { delay } from '../shared/utils/promises';
27
27
import { QError } from '../shared/error/error' ;
28
28
import { ErrorProvider } from '../../testing/rendering.unit-util' ;
29
29
import * as qError from '../shared/error/error' ;
30
+ import { QContainerValue } from '../shared/types' ;
31
+ import { QContainerAttr } from '../shared/utils/markers' ;
30
32
31
33
const debug = false ; //true;
32
34
Error . stackTraceLimit = 100 ;
@@ -360,24 +362,27 @@ describe.each([
360
362
) ;
361
363
} ) ;
362
364
const { document } = await render ( < Cmp /> , { debug } ) ;
365
+ const qContainerAttr = { [ QContainerAttr ] : QContainerValue . HTML } ;
363
366
await expect ( document . querySelector ( '#first' ) ) . toMatchDOM (
364
- < span id = "first" > vanilla HTML here</ span >
367
+ < span id = "first" { ...qContainerAttr } >
368
+ vanilla HTML here
369
+ </ span >
365
370
) ;
366
371
await expect ( document . querySelector ( '#second' ) ) . toMatchDOM (
367
- < span id = "second" class = "after" >
372
+ < span id = "second" class = "after" { ... qContainerAttr } >
368
373
< h1 > I'm an h1!</ h1 >
369
374
</ span >
370
375
) ;
371
376
await expect ( document . querySelector ( '#third' ) ) . toMatchDOM (
372
- < span id = "third" class = "after" >
377
+ < span id = "third" class = "after" { ... qContainerAttr } >
373
378
< h2 >
374
379
< span > I'm a signal value!</ span >
375
380
</ h2 >
376
381
</ span >
377
382
) ;
378
383
await trigger ( document . body , 'button' , 'click' ) ;
379
384
await expect ( document . querySelector ( '#third' ) ) . toMatchDOM (
380
- < span id = "third" class = "after" >
385
+ < span id = "third" class = "after" { ... qContainerAttr } >
381
386
< h2 >
382
387
< span > I'm a updated signal value!</ span >
383
388
</ h2 >
@@ -419,46 +424,51 @@ describe.each([
419
424
) ;
420
425
} ) ;
421
426
const { document } = await render ( < Parent /> , { debug } ) ;
427
+ const qContainerAttr = { [ QContainerAttr ] : QContainerValue . HTML } ;
422
428
await expect ( document . querySelector ( '#first' ) ) . toMatchDOM (
423
- < span id = "first" > vanilla HTML here</ span >
429
+ < span id = "first" { ...qContainerAttr } >
430
+ vanilla HTML here
431
+ </ span >
424
432
) ;
425
433
await expect ( document . querySelector ( '#second' ) ) . toMatchDOM (
426
- < span id = "second" class = "after" >
434
+ < span id = "second" class = "after" { ... qContainerAttr } >
427
435
< h1 > I'm an h1!</ h1 >
428
436
</ span >
429
437
) ;
430
438
await expect ( document . querySelector ( '#third' ) ) . toMatchDOM (
431
- < span id = "third" class = "after" >
439
+ < span id = "third" class = "after" { ... qContainerAttr } >
432
440
< h2 >
433
441
< span > I'm a signal value!</ span >
434
442
</ h2 >
435
443
</ span >
436
444
) ;
437
445
await expect ( document . querySelector ( '#fourth' ) ) . toMatchDOM (
438
- < span id = "fourth" class = "after" >
446
+ < span id = "fourth" class = "after" { ... qContainerAttr } >
439
447
< h3 > Test content</ h3 >
440
448
</ span >
441
449
) ;
442
450
443
451
await trigger ( document . body , 'button' , 'click' ) ;
444
452
445
453
await expect ( document . querySelector ( '#first' ) ) . toMatchDOM (
446
- < span id = "first" > vanilla HTML here</ span >
454
+ < span id = "first" { ...qContainerAttr } >
455
+ vanilla HTML here
456
+ </ span >
447
457
) ;
448
458
await expect ( document . querySelector ( '#second' ) ) . toMatchDOM (
449
- < span id = "second" class = "after" >
459
+ < span id = "second" class = "after" { ... qContainerAttr } >
450
460
< h1 > I'm an h1!</ h1 >
451
461
</ span >
452
462
) ;
453
463
await expect ( document . querySelector ( '#third' ) ) . toMatchDOM (
454
- < span id = "third" class = "after" >
464
+ < span id = "third" class = "after" { ... qContainerAttr } >
455
465
< h2 >
456
466
< span > I'm a updated signal value!</ span >
457
467
</ h2 >
458
468
</ span >
459
469
) ;
460
470
await expect ( document . querySelector ( '#fourth' ) ) . toMatchDOM (
461
- < span id = "fourth" class = "after" >
471
+ < span id = "fourth" class = "after" { ... qContainerAttr } >
462
472
< h3 > Test content</ h3 >
463
473
</ span >
464
474
) ;
@@ -476,9 +486,15 @@ describe.each([
476
486
} ) ;
477
487
478
488
const { document } = await render ( < Cmp /> , { debug } ) ;
479
- await expect ( document . querySelector ( 'textarea' ) ) . toMatchDOM ( < textarea > value 123</ textarea > ) ;
489
+ const qContainerAttr =
490
+ render === ssrRenderToDom ? { [ QContainerAttr ] : QContainerValue . TEXT } : { } ;
491
+ await expect ( document . querySelector ( 'textarea' ) ) . toMatchDOM (
492
+ < textarea { ...qContainerAttr } > value 123</ textarea >
493
+ ) ;
480
494
await trigger ( document . body , 'button' , 'click' ) ;
481
- await expect ( document . querySelector ( 'textarea' ) ) . toMatchDOM ( < textarea > value 123!</ textarea > ) ;
495
+ await expect ( document . querySelector ( 'textarea' ) ) . toMatchDOM (
496
+ < textarea { ...qContainerAttr } > value 123!</ textarea >
497
+ ) ;
482
498
} ) ;
483
499
484
500
it ( 'should render textarea without error' , async ( ) => {
@@ -497,7 +513,11 @@ describe.each([
497
513
} ) ;
498
514
499
515
const { document } = await render ( < Cmp /> , { debug } ) ;
500
- await expect ( document . querySelector ( 'textarea' ) ) . toMatchDOM ( < textarea > </ textarea > ) ;
516
+ const qContainerAttr =
517
+ render === ssrRenderToDom ? { [ QContainerAttr ] : QContainerValue . TEXT } : { } ;
518
+ await expect ( document . querySelector ( 'textarea' ) ) . toMatchDOM (
519
+ < textarea { ...qContainerAttr } > </ textarea >
520
+ ) ;
501
521
} ) ;
502
522
503
523
it ( 'should not render textarea value for non-text value' , async ( ) => {
@@ -1992,14 +2012,15 @@ describe.each([
1992
2012
) ;
1993
2013
} ) ;
1994
2014
const { document, container } = await render ( < Issue3643 /> , { debug } ) ;
2015
+ const qContainerAttr = { [ QContainerAttr ] : QContainerValue . HTML } ;
1995
2016
await expect ( document . querySelector ( 'main' ) ) . toMatchDOM (
1996
2017
< main >
1997
2018
< button > Toggle</ button >
1998
2019
< div >
1999
- < div > Hello</ div >
2020
+ < div { ... qContainerAttr } > Hello</ div >
2000
2021
</ div >
2001
2022
< div >
2002
- < div > Hello</ div >
2023
+ < div { ... qContainerAttr } > Hello</ div >
2003
2024
</ div >
2004
2025
</ main >
2005
2026
) ;
@@ -2022,10 +2043,10 @@ describe.each([
2022
2043
< main >
2023
2044
< button > Toggle</ button >
2024
2045
< div >
2025
- < div > Hello</ div >
2046
+ < div { ... qContainerAttr } > Hello</ div >
2026
2047
</ div >
2027
2048
< div >
2028
- < div > Hello</ div >
2049
+ < div { ... qContainerAttr } > Hello</ div >
2029
2050
</ div >
2030
2051
</ main >
2031
2052
) ;
@@ -2048,10 +2069,10 @@ describe.each([
2048
2069
< main >
2049
2070
< button > Toggle</ button >
2050
2071
< div >
2051
- < div > Hello</ div >
2072
+ < div { ... qContainerAttr } > Hello</ div >
2052
2073
</ div >
2053
2074
< div >
2054
- < div > Hello</ div >
2075
+ < div { ... qContainerAttr } > Hello</ div >
2055
2076
</ div >
2056
2077
</ main >
2057
2078
) ;
0 commit comments