|
22 | 22 |
|
23 | 23 | <script>
|
24 | 24 | test((t) => {
|
| 25 | + t.add_cleanup(() => { |
| 26 | + multiple1.remove(); |
| 27 | + multiple2.remove(); |
| 28 | + }); |
25 | 29 | let shadow = multiple1.shadowRoot;
|
26 | 30 | assert_true(!!shadow,'Remaining shadow root should be open');
|
27 | 31 | assert_equals(shadow.textContent,"Open");
|
| 32 | + assert_equals(multiple1.childElementCount, 1); |
| 33 | + assert_equals(multiple1.firstElementChild.shadowRootMode, "closed"); |
28 | 34 | shadow = multiple2.shadowRoot;
|
29 | 35 | assert_false(!!shadow,'Remaining shadow root should be closed');
|
30 |
| - multiple1.remove(); // Cleanup |
31 |
| - multiple2.remove(); |
| 36 | + assert_equals(multiple2.childElementCount, 1); |
| 37 | + assert_equals(multiple2.firstElementChild.shadowRootMode, "open"); |
32 | 38 | },'Repeated declarative shadow roots keep only the first');
|
33 | 39 | </script>
|
34 | 40 |
|
|
59 | 65 | test((t) => {
|
60 | 66 | assert_throws_dom("NotSupportedError",() => {
|
61 | 67 | open2.attachShadow({mode: "closed", delegatesFocus: true, slotAssignment: "named", clonable: true});
|
62 |
| - },'Mismatched shadow root type should throw'); |
63 |
| - assert_throws_dom("NotSupportedError",() => { |
64 |
| - open2.attachShadow({mode: "open", delegatesFocus: false, slotAssignment: "named", clonable: true}); |
65 |
| - },'Mismatched shadow root delegatesFocus should throw'); |
66 |
| - assert_throws_dom("NotSupportedError",() => { |
67 |
| - open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "manual", clonable: true}); |
68 |
| - },'Mismatched shadow root slotAssignment should throw'); |
69 |
| - assert_throws_dom("NotSupportedError",() => { |
70 |
| - open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: false}); |
71 |
| - },'Mismatched shadow root clonable should throw'); |
| 68 | + },'Mismatched shadow root mode should throw'); |
72 | 69 |
|
73 | 70 | const initialShadow = open2.shadowRoot;
|
74 | 71 | const shadow = open2.attachShadow({mode: "open", delegatesFocus: true, slotAssignment: "named", clonable: true}); // Shouldn't throw
|
75 | 72 | assert_equals(shadow,initialShadow,'Same shadow should be returned');
|
76 | 73 | assert_equals(shadow.textContent,'','Shadow should be empty');
|
| 74 | + |
| 75 | + assert_throws_dom("NotSupportedError",() => { |
| 76 | + open2.attachShadow({mode: "open"}); |
| 77 | + },'Invoking attachShadow() on a non-declarative shadow root should throw'); |
| 78 | + |
77 | 79 | },'Calling attachShadow() on declarative shadow root must match all parameters');
|
78 | 80 | </script>
|
0 commit comments