Skip to content

Commit 8565cb0

Browse files
committed
feat(toolbar): implemented split actions for toolbar
1 parent 37ac3fc commit 8565cb0

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/hydrate/runner/render.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ export function hydrateDocument(
7070
asStream?: boolean,
7171
): Promise<HydrateResults> | Readable {
7272
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;
7378

7479
let win: MockWindow | null = null;
7580
const results = generateHydrateResults(opts);

test/end-to-end/src/declarative-shadow-dom/test.e2e.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,4 +375,27 @@ describe('renderToString', () => {
375375
</nested-cmp-child>
376376
</nested-cmp-parent>`);
377377
});
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+
378401
});

0 commit comments

Comments
 (0)