summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html')
-rw-r--r--dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html71
1 files changed, 71 insertions, 0 deletions
diff --git a/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
new file mode 100644
index 000000000..4eefa165f
--- /dev/null
+++ b/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
@@ -0,0 +1,71 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=999999
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 999999</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=999999">Mozilla Bug 999999</a>
+<p id="display"></p>
+<div id="content">
+<div id="shadowhost"></div>
+</div>
+<pre id="test">
+</pre>
+<script type="application/javascript">
+
+/** Test for Bug 999999 **/
+var host = document.getElementById("shadowhost");
+
+// Test destination insertion points of node distributed to content element.
+var shadowRoot = host.createShadowRoot();
+shadowRoot.innerHTML = '<div id="innerhost"><content id="innercontent"></content></div>';
+
+var fallback = document.createElement("span");
+var innerContent = shadowRoot.getElementById("innercontent");
+
+innerContent.appendChild(fallback);
+
+is(fallback.getDestinationInsertionPoints().length, 1, "Active fallback content should be distributed to insertion point.");
+is(fallback.getDestinationInsertionPoints()[0], innerContent, "Insertion point should be in list of destination insertion points.");
+
+// Test destination insertion points of reprojected fallback content.
+var innerHost = shadowRoot.getElementById("innerhost");
+var innerShadowRoot = innerHost.createShadowRoot();
+innerShadowRoot.innerHTML = '<content id="innerinnercontent"></content>';
+
+var innerInnerContent = innerShadowRoot.getElementById("innerinnercontent");
+
+is(fallback.getDestinationInsertionPoints().length, 2, "Fallback content should have been distributed into parent and reprojected into another insertion point.");
+is(fallback.getDestinationInsertionPoints()[1], innerInnerContent, "Destination insertion points should contain content element to which the node was reprojected.");
+
+// Test destination insertion points of fallback content that was dropped due to content element matching a node in the host.
+var span = document.createElement("span");
+host.appendChild(span);
+
+is(fallback.getDestinationInsertionPoints().length, 0, "After dropping insertion points, fallback content should not have any nodes in destination insertion points list.");
+
+// Test destination insertion points of fallback content after reactivating by dropping matched content on host.
+host.removeChild(span);
+is(fallback.getDestinationInsertionPoints().length, 2, "Fallback content should have 2 destination insertion points after being reactivated.");
+is(fallback.getDestinationInsertionPoints()[0], innerContent, "First destination insertion point should be the parent content");
+is(fallback.getDestinationInsertionPoints()[1], innerInnerContent, "Second destination insertion point should be the content to which the node is reprojected.");
+
+// Test destination insertion points of fallback content after removed from the tree.
+innerContent.removeChild(fallback);
+is(fallback.getDestinationInsertionPoints().length, 0, "Fallback content is no longer fallback content, destination insertion points should be empty.");
+
+// Test destination insertion points of child of non-insertion point content element.
+var notInsertionPointContent = document.createElement("content");
+var notFallback = document.createElement("span");
+notInsertionPointContent.appendChild(notFallback);
+is(notFallback.getDestinationInsertionPoints().length, 0, "Child of non-insertion point content should not be distributed to any nodes.");
+
+</script>
+</body>
+</html>