Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Unified Diff: third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html

Issue 1995203002: Rewrite Shadow DOM distribution engine to support partial synchronous distribution for v1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No longer FAIL: imported/wpt/shadow-dom/HTMLSlotElement-interface.html Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html
diff --git a/third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html b/third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html
new file mode 100644
index 0000000000000000000000000000000000000000..449ae2c204ec32801860f5cac3847c9a49dd9368
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/shadow-dom/slotchange-host-child-appended.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<script src='../resources/testharness.js'></script>
+<script src='../resources/testharnessreport.js'></script>
+<script src='resources/shadow-dom.js'></script>
+<div id='d1'>
+ <template data-mode='open' data-expose-as='d1_shadow'>
+ <slot name='d1-s1'></slot>
+ </template>
+ <div id='d2' slot='d1-s1'></div>
+</div>
+<script>
+'use strict';
+convertTemplatesToShadowRootsWithin(d1);
+removeWhiteSpaceOnlyTextNodes(d1);
+
+async_test((test) => {
+
+ const d1_s1 = d1_shadow.querySelector('slot');
+
+ assert_array_equals(d1_s1.assignedNodes(), [d2]);
+ assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2]);
+
+ d1_s1.addEventListener('slotchange', (e) => {
+ test.step(() => {
+ assert_equals(e.target, d1_s1);
+ assert_array_equals(d1_s1.assignedNodes(), [d2, d3]);
+ assert_array_equals(d1_s1.assignedNodes({'flatten': true}), [d2, d3]);
+ assert_equals(e.scoped, true);
+ test.done();
+ });
+ });
+
+ const d3 = document.createElement('div');
+ d3.setAttribute('id', 'd3');
+ d3.setAttribute('slot', 'd1-s1');
+ d1.appendChild(d3);
+}, "slotchange event caused by appending a host child");
+</script>

Powered by Google App Engine
This is Rietveld 408576698