File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed
test/end-to-end/src/declarative-shadow-dom Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,11 @@ export function hydrateDocument(
70
70
asStream ?: boolean ,
71
71
) : Promise < HydrateResults > | Readable {
72
72
const opts = normalizeHydrateOptions ( options ) ;
73
+ /**
74
+ * Defines whether we render the shadow root as a declarative shadow root or as scoped shadow root.
75
+ */
76
+ opts . serializeShadowRoot =
77
+ typeof opts . serializeShadowRoot === 'undefined' ? 'declarative-shadow-dom' : opts . serializeShadowRoot ;
73
78
74
79
let win : MockWindow | null = null ;
75
80
const results = generateHydrateResults ( opts ) ;
Original file line number Diff line number Diff line change @@ -375,4 +375,27 @@ describe('renderToString', () => {
375
375
</nested-cmp-child>
376
376
</nested-cmp-parent>` ) ;
377
377
} ) ;
378
+
379
+ describe ( 'hydrateDocument' , ( ) => {
380
+
381
+ it ( 'can hydrate components with open shadow dom by default' , async ( ) => {
382
+ const { html } = await hydrateDocument ( '<another-car-detail></another-car-detail>' , {
383
+ fullDocument : false ,
384
+ } ) ;
385
+ expect ( html ) . toContain ( 's-id="' ) ;
386
+ expect ( html ) . toContain ( 'shadowrootmode="open"' ) ;
387
+ } ) ;
388
+
389
+ it ( 'can hydrate components with scoped shadow dom and' , async ( ) => {
390
+ const { html } = await hydrateDocument ( '<another-car-detail></another-car-detail>' , {
391
+ serializeShadowRoot : 'scoped' ,
392
+ fullDocument : false ,
393
+ } ) ;
394
+ expect ( html ) . toContain ( 's-id="' ) ;
395
+ expect ( html ) . not . toContain ( 'shadowrootmode="open"' ) ;
396
+ } ) ;
397
+
398
+
399
+ } ) ;
400
+
378
401
} ) ;
You can’t perform that action at this time.
0 commit comments