diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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_dest_insertion_points_shadow.html')
-rw-r--r-- | dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html new file mode 100644 index 000000000..75286463e --- /dev/null +++ b/dom/tests/mochitest/webcomponents/test_dest_insertion_points_shadow.html @@ -0,0 +1,68 @@ +<!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 shadow element. +var olderShadowRoot = host.createShadowRoot(); +var youngerShadowRoot = host.createShadowRoot(); + +var shadowElem = document.createElement("shadow"); +youngerShadowRoot.appendChild(shadowElem); + +var span = document.createElement("span"); +olderShadowRoot.appendChild(span); + +is(span.getDestinationInsertionPoints().length, 1, "Child of ShadowRoot should be distributed to shadow insertion point."); +is(span.getDestinationInsertionPoints()[0], shadowElem, "Shadow element should be in destination insertion point list."); + +// Test destination insertion points of node removed from tree. +olderShadowRoot.removeChild(span); +is(span.getDestinationInsertionPoints().length, 0, "Node removed from tree should no longer be distributed."); + +// Test destination insertion points of fallback content being reprojected into a shadow element. +var content = document.createElement("content"); +var fallback = document.createElement("span"); + +content.appendChild(fallback); +olderShadowRoot.appendChild(content); + +is(fallback.getDestinationInsertionPoints().length, 2, "The fallback content should have 2 destination insertion points, the parent content and the shadow element to which it is reprojected."); +is(fallback.getDestinationInsertionPoints()[0], content, "First destination of the fallback content should be the parent content element."); +is(fallback.getDestinationInsertionPoints()[1], shadowElem, "Second destination of the fallback content should be the shadow element to which the element is reprojected."); + +// Test destination insertion points of fallback content being removed from tree. +content.removeChild(fallback); +is(fallback.getDestinationInsertionPoints().length, 0, "The content should no longer be distributed to any nodes because it is no longer fallback content."); + +// Test destination insertion points of distributed content after removing shadow insertion point. +var div = document.createElement("div"); +olderShadowRoot.appendChild(div); +is(div.getDestinationInsertionPoints().length, 1, "Children in older shadow root should be distributed to shadow insertion point."); +is(div.getDestinationInsertionPoints()[0], shadowElem, "Destination insertion point should include shadow element."); + +youngerShadowRoot.removeChild(shadowElem); +is(div.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after removing shadow element."); + +</script> +</body> +</html> |