summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html')
-rw-r--r--testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html53
1 files changed, 34 insertions, 19 deletions
diff --git a/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html b/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html
index 69f5c0f077..9cee41f2f3 100644
--- a/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html
+++ b/testing/web-platform/tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html
@@ -22,13 +22,19 @@
<script>
test((t) => {
+ t.add_cleanup(() => {
+ multiple1.remove();
+ multiple2.remove();
+ });
let shadow = multiple1.shadowRoot;
assert_true(!!shadow,'Remaining shadow root should be open');
assert_equals(shadow.textContent,"Open");
+ assert_equals(multiple1.childElementCount, 1);
+ assert_equals(multiple1.firstElementChild.shadowRootMode, "closed");
shadow = multiple2.shadowRoot;
assert_false(!!shadow,'Remaining shadow root should be closed');
- multiple1.remove(); // Cleanup
- multiple2.remove();
+ assert_equals(multiple2.childElementCount, 1);
+ assert_equals(multiple2.firstElementChild.shadowRootMode, "open");
},'Repeated declarative shadow roots keep only the first');
</script>
@@ -40,39 +46,48 @@ test((t) => {
test((t) => {
assert_throws_dom("NotSupportedError",() => {
open1.attachShadow({mode: "closed"});
- },'Mismatched shadow root type should throw');
+ },'Mismatched shadow root mode should throw');
const initialShadow = open1.shadowRoot;
const shadow = open1.attachShadow({mode: "open"}); // Shouldn't throw
assert_equals(shadow,initialShadow,'Same shadow should be returned');
assert_equals(shadow.textContent,'','Shadow should be empty');
-},'Calling attachShadow() on declarative shadow root must match type');
+},'Calling attachShadow() on declarative shadow root must match mode');
</script>
<div id=open2>
- <template shadowrootmode=open shadowrootdelegatesfocus shadowrootclonable>
+ <template shadowrootmode=open shadowrootdelegatesfocus shadowrootclonable serializable>
Open, delegates focus (not the default), clonable (not the default)
- named slot assignment (the default)
+ serializable (not the default), named slot assignment (the default)
</template>
</div>
<script>
test((t) => {
+ t.add_cleanup(() => open2.remove());
+ assert_true(!!open2.shadowRoot);
+ // Changing the mode should throw.
assert_throws_dom("NotSupportedError",() => {
- open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named", clonable: true});
- },'Mismatched shadow root type should throw');
+ open2.attachShadow({mode: "closed"});
+ },'Mismatched shadow root mode should throw');
assert_throws_dom("NotSupportedError",() => {
- open2.attachShadow({mode: "open", delegatesFocus: false, slotAssignment: "named", clonable: true});
- },'Mismatched shadow root delegatesFocus should throw');
- assert_throws_dom("NotSupportedError",() => {
- open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "manual", clonable: true});
- },'Mismatched shadow root slotAssignment should throw');
- assert_throws_dom("NotSupportedError",() => {
- open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: false});
- },'Mismatched shadow root clonable should throw');
+ open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named", clonable: true, serializable: true});
+ },'Mismatched shadow root mode should throw (explicit args)');
+ // Changing other things should not throw, and should not change the shadow root's settings
const initialShadow = open2.shadowRoot;
- const shadow = open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: true}); // Shouldn't throw
- assert_equals(shadow,initialShadow,'Same shadow should be returned');
- assert_equals(shadow.textContent,'','Shadow should be empty');
+ assert_equals(initialShadow.delegatesFocus,true);
+ assert_equals(initialShadow.slotAssignment,"named");
+ assert_true(initialShadow.clonable);
+ assert_true(initialShadow.serializable);
+ let newShadow = open2.attachShadow({mode: "open", delegatesFocus: false, slotAssignment: "manual", clonable: false, serializable: false});
+ assert_equals(newShadow,initialShadow,'Same shadow should be returned');
+ assert_equals(newShadow.textContent,'','Shadow should be empty');
+ assert_equals(newShadow.delegatesFocus,true);
+ assert_equals(newShadow.slotAssignment,"named");
+ assert_true(newShadow.clonable);
+ assert_true(newShadow.serializable);
+ assert_throws_dom("NotSupportedError",() => {
+ open2.attachShadow({mode: "open"});
+ },'Invoking attachShadow() on a non-declarative shadow root should throw');
},'Calling attachShadow() on declarative shadow root must match all parameters');
</script>