Skip to content

Commit

Permalink
Bug 1876889 [wpt PR 44246] - Check for matching serializable in att…
Browse files Browse the repository at this point in the history
…achShadow, a=testonly

Automatic update from web-platform-tests
Check for matching `serializable` in attachShadow

This parameter was added ([1]) after the initial check code was written
([3]). Note that [2] also added `clonable` but there's an issue [4]
about checking that in a similar way.

[1] https://chromium-review.googlesource.com/c/chromium/src/+/5239221
[2] https://chromium-review.googlesource.com/c/chromium/src/+/5239277
[3] https://chromium-review.googlesource.com/c/chromium/src/+/5191750
[4] whatwg/html#10107

Bug: 1517959
Change-Id: I689c6a6f84fb7ce298cf187076ae228fef6cc348
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5242281
Commit-Queue: David Baron <[email protected]>
Reviewed-by: David Baron <[email protected]>
Auto-Submit: Mason Freed <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1253972}

--

wpt-commits: 9d88a7f08bafe30d73d49d0b9d026d4a4603916e
wpt-pr: 44246
  • Loading branch information
mfreed7 authored and moz-wptsync-bot committed Feb 2, 2024
1 parent f47dfd9 commit 2c9b40e
Showing 1 changed file with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,30 @@

<div id=open2>
<template shadowrootmode=open shadowrootdelegatesfocus>
Open, delegates focus (not the default), named slot assignment (the default)
Open, delegates focus (not the default),
named slot assignment (the default), clonable (the default for declarative)
</template>
</div>

<script>
test((t) => {
assert_throws_dom("NotSupportedError",() => {
open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named"});
open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named", clonable: true});
},'Mismatched shadow root type should throw');
assert_throws_dom("NotSupportedError",() => {
open2.attachShadow({mode: "open", delegatesFocus: false, slotAssignment: "named"});
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"});
open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "manual", clonable: true});
},'Mismatched shadow root slotAssignment should throw');
// See https://github.com/whatwg/html/issues/10107: the behavior of the
// clonable flag is still being discussed.
// assert_throws_dom("NotSupportedError",() => {
// open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: false});
// },'Mismatched shadow root clonable should throw');

const initialShadow = open2.shadowRoot;
const shadow = open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named"}); // Shouldn't throw
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');
},'Calling attachShadow() on declarative shadow root must match all parameters');
Expand Down

0 comments on commit 2c9b40e

Please sign in to comment.