summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/shadow-dom/slot-fallback-content-003.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/shadow-dom/slot-fallback-content-003.html')
-rw-r--r--testing/web-platform/tests/shadow-dom/slot-fallback-content-003.html47
1 files changed, 47 insertions, 0 deletions
diff --git a/testing/web-platform/tests/shadow-dom/slot-fallback-content-003.html b/testing/web-platform/tests/shadow-dom/slot-fallback-content-003.html
new file mode 100644
index 0000000000..ab7b2af05a
--- /dev/null
+++ b/testing/web-platform/tests/shadow-dom/slot-fallback-content-003.html
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<meta charset="utf-8" >
+<meta name="author" title="Di Zhang" href="mailto:dizhangg@chromium.org">
+<meta name="assert" content="Modify slot fallback contents, when dynamically created.">
+<title>Shadow DOM: Slots and fallback contents</title>
+<link rel="match" href="slot-fallback-content-003-ref.html">
+
+<p>Test passes if there are two lines of text "SLOT1", "A" below.</p>
+
+<div id="host1"><slot id="slot1">SLOT1</slot></div>
+
+<p>Test passes if there is one line of text "C" below.</p>
+
+<div id="host2"><slot id="slot2">
+ <div id="B">FAIL</div>
+ <div id="C">C</div>
+</slot></div>
+
+<p>Test passes if empty.</p>
+
+<div id="host3">
+ <slot id="slot3">
+ <div id="D">FAIL</div>
+ </slot>
+</div>
+
+<script>
+// Content added to existing fallback content will be rendered
+const shadowRoot1 = host1.attachShadow({ mode: "open" });
+shadowRoot1.appendChild(slot1);
+const A = document.createElement('div');
+A.innerText = 'A';
+shadowRoot1.getElementById('slot1').appendChild(A);
+
+// Remove some content from existing slot fallback will render the leftover fallback
+const shadowRoot2 = host2.attachShadow({ mode: "open" });
+shadowRoot2.appendChild(slot2);
+const B = shadowRoot2.getElementById('B');
+B.remove();
+
+// // Remove all content from existing slot fallback will render no fallback
+const shadowRoot3 = host3.attachShadow({ mode: "open" });
+shadowRoot3.appendChild(slot3);
+const D = shadowRoot3.getElementById('D');
+D.remove();
+
+</script>