Modified: trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html (235567 => 235568)
--- trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html 2018-08-31 20:23:48 UTC (rev 235567)
+++ trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html 2018-08-31 20:41:57 UTC (rev 235568)
@@ -75,7 +75,7 @@
test_slotchange_event_bubbles('open', true);
function test_single_slotchange_event_for_nested_slots(outerMode, innerMode, connected) {
- promise_test(() => {
+ promise_test(async () => {
const outerHost = document.createElement('outer-host');
if (connected)
document.body.appendChild(outerHost);
@@ -91,6 +91,8 @@
const innerSlotParent = innerShadow.querySelector('div');
const innerSlot = innerShadow.querySelector('slot');
+ await Promise.resolve();
+
const observer = create_slotchange_observer();
observer.observe(outerSlot);
observer.observe(innerHost);
@@ -109,23 +111,23 @@
outerHost.textContent = ' ';
assert_array_equals(observer.takeLog(), [], 'slotchange event must not be fired synchronously');
- return Promise.resolve().then(() => {
- const log = observer.takeLog();
+ await Promise.resolve();
- const events = new Set(log.map((entry) => entry.event));
- assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event');
+ const log = observer.takeLog();
- assert_slotchange_log(log[0], outerSlot, outerSlot, 'slotchange event must be dispatched at the slot element first');
- assert_slotchange_log(log[1], innerSlot, outerSlot, 'slotchange event must bubble up from a slot element to its assigned slot');
- assert_slotchange_log(log[2], innerSlotParent, outerSlot, 'slotchange event must bubble up to the parent node of a slot');
- assert_slotchange_log(log[3], innerShadow, outerSlot, 'slotchange event must bubble up to the shadow root');
- assert_slotchange_log(log[4], innerHost, outerSlot,
- 'slotchange event must bubble up to the shadow host if the host is a descendent of the tree in which the event was fired');
- assert_slotchange_log(log[5], outerHostParent, outerSlot,
- 'slotchange event must bubble up to the parent of an inner shadow host');
- assert_slotchange_log(log[6], outerShadow, outerSlot, 'slotchange event must bubble up to the shadow root');
- assert_equals(log.length, 7, 'slotchange must not bubble beyond the shadow root in which the event was fired');
- });
+ const events = new Set(log.map((entry) => entry.event));
+ assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event');
+
+ assert_slotchange_log(log[0], outerSlot, outerSlot, 'slotchange event must be dispatched at the slot element first');
+ assert_slotchange_log(log[1], innerSlot, outerSlot, 'slotchange event must bubble up from a slot element to its assigned slot');
+ assert_slotchange_log(log[2], innerSlotParent, outerSlot, 'slotchange event must bubble up to the parent node of a slot');
+ assert_slotchange_log(log[3], innerShadow, outerSlot, 'slotchange event must bubble up to the shadow root');
+ assert_slotchange_log(log[4], innerHost, outerSlot,
+ 'slotchange event must bubble up to the shadow host if the host is a descendent of the tree in which the event was fired');
+ assert_slotchange_log(log[5], outerHostParent, outerSlot,
+ 'slotchange event must bubble up to the parent of an inner shadow host');
+ assert_slotchange_log(log[6], outerShadow, outerSlot, 'slotchange event must bubble up to the shadow root');
+ assert_equals(log.length, 7, 'slotchange must not bubble beyond the shadow root in which the event was fired');
}, `A single slotchange event must bubble from a ${connected ? 'connected' : 'disconnected'} ${innerMode}-mode shadow tree to`
+ `a slot in its parent ${outerMode}-mode shadow tree`);
}
Modified: trunk/LayoutTests/fast/shadow-dom/slotchange-in-fallback.html (235567 => 235568)
--- trunk/LayoutTests/fast/shadow-dom/slotchange-in-fallback.html 2018-08-31 20:23:48 UTC (rev 235567)
+++ trunk/LayoutTests/fast/shadow-dom/slotchange-in-fallback.html 2018-08-31 20:41:57 UTC (rev 235568)
@@ -19,14 +19,14 @@
testMutatingSlot('open', false, ...args);
}
-function testMutatingSlot(mode, connectedToDocument, shadowContent, slotName, prepareSlot, mutateSlot, description)
+function testMutatingSlot(mode, connectedToDocument, hostContent, slotName, prepareSlot, mutateSlot, description)
{
promise_test(async function () {
const host = document.createElement('div');
if (connectedToDocument)
document.body.appendChild(host);
- if (shadowContent)
- host.innerHTML = shadowContent;
+ if (hostContent)
+ host.innerHTML = hostContent;
const shadowRoot = host.attachShadow({mode});
@@ -44,9 +44,9 @@
mutateSlot(slot);
await Promise.resolve();
- assert_equals(eventCount, shadowContent ? 0 : 1);
+ assert_equals(eventCount, hostContent ? 0 : 1);
- slot.remove();
+ host.remove();
}, description + ` in a ${connectedToDocument ? 'connected' : 'disconnected'} ${mode} mode shadow root`);
}