Skip to content

Commit

Permalink
Add multi-host test case for declarative Shadow DOM
Browse files Browse the repository at this point in the history
This case was not previously tested.

Bug: 1042130
Change-Id: I5874bc08abba57b6d5150ab8ae772ecec6113b19
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2161767
Commit-Queue: Mason Freed <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Reviewed-by: Kouhei Ueno <[email protected]>
Cr-Commit-Position: refs/heads/master@{#762045}
  • Loading branch information
mfreed7 authored and chromium-wpt-export-bot committed Apr 23, 2020
1 parent 6b95064 commit 13868f2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,24 @@
assert_true(!!host.shadowRoot,"No shadow root found");
assert_false(host.shadowRoot.delegatesFocus,"delegatesFocus should be false without the shadowrootdelegatesfocus attribute");
}, 'Declarative Shadow DOM: delegates focus attribute');
</script>

<div id="multi-host">
<template shadowroot="open">
<span>root 1</span>
</template>
<template shadowroot="closed">
<span>root 2</span>
</template>
</div>

<script>
test(() => {
const host = document.querySelector('#multi-host');
assert_equals(host.querySelector('template'), null, "No leftover template nodes from either root");
assert_true(!!host.shadowRoot,"No open shadow root found - first root should remain");
const innerSpan = host.shadowRoot.querySelector('span');
assert_equals(innerSpan.textContent, 'root 2', "Content should come from last declarative shadow root");
}, 'Declarative Shadow DOM: Multiple roots');

</script>

0 comments on commit 13868f2

Please sign in to comment.