summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2020-04-17 07:08:22 -0400
committerMatt A. Tobin <email@mattatobin.com>2020-04-17 07:08:22 -0400
commit8beb65dd501cbdcfd6a793027b5de2a1fdfc7149 (patch)
tree4b524fb1a1888b37bc347dc65c7c200979fe54aa /dom/tests/mochitest
parent5524318fe73a1123da10491a6a545b50af88ea60 (diff)
downloadUXP-8beb65dd501cbdcfd6a793027b5de2a1fdfc7149.tar
UXP-8beb65dd501cbdcfd6a793027b5de2a1fdfc7149.tar.gz
UXP-8beb65dd501cbdcfd6a793027b5de2a1fdfc7149.tar.lz
UXP-8beb65dd501cbdcfd6a793027b5de2a1fdfc7149.tar.xz
UXP-8beb65dd501cbdcfd6a793027b5de2a1fdfc7149.zip
Bug 1418002 - Remove HTMLContentElement
Tag #1375
Diffstat (limited to 'dom/tests/mochitest')
-rw-r--r--dom/tests/mochitest/webcomponents/mochitest.ini4
-rw-r--r--dom/tests/mochitest/webcomponents/test_dest_insertion_points.html73
-rw-r--r--dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html50
-rw-r--r--dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html71
-rw-r--r--dom/tests/mochitest/webcomponents/test_nested_content_element.html127
5 files changed, 0 insertions, 325 deletions
diff --git a/dom/tests/mochitest/webcomponents/mochitest.ini b/dom/tests/mochitest/webcomponents/mochitest.ini
index 2cfd747c4..d56196272 100644
--- a/dom/tests/mochitest/webcomponents/mochitest.ini
+++ b/dom/tests/mochitest/webcomponents/mochitest.ini
@@ -25,11 +25,7 @@ skip-if = !debug # TestFunctions only applied in debug builds
[test_custom_element_define.html]
[test_custom_element_define_parser.html]
[test_custom_element_template.html]
-[test_nested_content_element.html]
-[test_dest_insertion_points.html]
-[test_fallback_dest_insertion_points.html]
[test_detached_style.html]
-[test_dynamic_content_element_matching.html]
[test_document_adoptnode.html]
[test_document_importnode.html]
[test_document_register.html]
diff --git a/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html
deleted file mode 100644
index 2d4a92ed2..000000000
--- a/dom/tests/mochitest/webcomponents/test_dest_insertion_points.html
+++ /dev/null
@@ -1,73 +0,0 @@
-<!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" select=".red"></content></div>';
-var innerContent = shadowRoot.getElementById("innercontent");
-
-var span = document.createElement("span");
-span.setAttribute("class", "red blue");
-is(host.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty when not being distributed.");
-
-host.appendChild(span);
-
-is(span.getDestinationInsertionPoints().length, 1, "Destination insertion points should only contain a single content insertion point.");
-is(span.getDestinationInsertionPoints()[0], innerContent, "Content element should contain destination insertion point.");
-
-// Test destination insertion points of redistributed node.
-var innerHost = shadowRoot.getElementById("innerhost");
-var innerShadowRoot = innerHost.createShadowRoot();
-innerShadowRoot.innerHTML = '<content id="innerinnercontent" select=".blue"></content>';
-
-var innerInnerContent = innerShadowRoot.getElementById("innerinnercontent");
-
-is(span.getDestinationInsertionPoints().length, 2, "Redistributed node should have 2 destination insertion points.");
-is(span.getDestinationInsertionPoints()[1], innerInnerContent, "Nested content insertion point should be in list of destination insertion points.");
-
-// Test destination insertion points after removing reprojection onto second content element.
-span.setAttribute("class", "red");
-is(span.getDestinationInsertionPoints().length, 1, "Destination insertion points should only contain 1 insertion point after removing reprojection.");
-is(span.getDestinationInsertionPoints()[0], innerContent, "First content element should be only insertion point after removing reprojection.");
-
-// Test destination insertion points after removing the projected content from the host.
-host.removeChild(span);
-is(span.getDestinationInsertionPoints().length, 0, "Destination insertion points should be empty after being removed from the shadow host.");
-
-// Test destination insertion points of distributed content after removing insertion point.
-var div = document.createElement("div");
-div.setAttribute("class", "red blue");
-host.appendChild(div);
-
-is(div.getDestinationInsertionPoints().length, 2, "Div should be distributed into 2 insertion points.");
-
-innerShadowRoot.removeChild(innerInnerContent);
-
-is(div.getDestinationInsertionPoints().length, 1, "Div should be distributed into insertion point in one ShadowRoot.");
-is(div.getDestinationInsertionPoints()[0], innerContent, "Destination insertion points should only contain content insertion point in first ShadowRoot.");
-
-</script>
-</body>
-</html>
diff --git a/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html b/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html
deleted file mode 100644
index c9af76610..000000000
--- a/dom/tests/mochitest/webcomponents/test_dynamic_content_element_matching.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=806506
--->
-<head>
- <title>Test for dynamic changes to content matching content elements</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<div class="tall" id="bodydiv"></div>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
-<script>
-// Create ShadowRoot.
-var elem = document.createElement("div");
-var root = elem.createShadowRoot();
-
-var redInsertionPoint = document.createElement("content");
-redInsertionPoint.select = "*[data-color=red]";
-
-var blueInsertionPoint = document.createElement("content");
-blueInsertionPoint.select = "*[data-color=blue]";
-
-root.appendChild(redInsertionPoint);
-root.appendChild(blueInsertionPoint);
-
-is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes.");
-is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should have no distrubted nodes.");
-
-var matchElement = document.createElement("div");
-matchElement.setAttribute("data-color", "red");
-elem.appendChild(matchElement);
-
-is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes.");
-is(redInsertionPoint.getDistributedNodes().length, 1, "Red insertion point should match recently inserted div.");
-
-matchElement.setAttribute("data-color", "blue");
-is(blueInsertionPoint.getDistributedNodes().length, 1, "Blue insertion point should match element after changing attribute value.");
-is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should not match element after changing attribute value.");
-
-matchElement.removeAttribute("data-color");
-
-is(blueInsertionPoint.getDistributedNodes().length, 0, "Blue insertion point should have no distributed nodes after removing the matching attribute.");
-is(redInsertionPoint.getDistributedNodes().length, 0, "Red insertion point should have no distrubted nodes after removing the matching attribute.");
-
-</script>
-</body>
-</html>
-
diff --git a/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html b/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
deleted file mode 100644
index 4eefa165f..000000000
--- a/dom/tests/mochitest/webcomponents/test_fallback_dest_insertion_points.html
+++ /dev/null
@@ -1,71 +0,0 @@
-<!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>
diff --git a/dom/tests/mochitest/webcomponents/test_nested_content_element.html b/dom/tests/mochitest/webcomponents/test_nested_content_element.html
deleted file mode 100644
index 1d98d2996..000000000
--- a/dom/tests/mochitest/webcomponents/test_nested_content_element.html
+++ /dev/null
@@ -1,127 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=806506
--->
-<head>
- <title>Test for HTMLContent element</title>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<div id="grabme"></div>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=806506">Bug 806506</a>
-<script>
-
-/**
- * Constructs a node with a nested ShadowRoot with the following structure:
- * <span> - - - - - - - - - - <ShadowRoot>
- * <span> <span> - - - - - - - - - - <ShadowRoot>
- * id=one id=four <span>
- * data-color=red data-color=orange id=eleven
- * <span> <span> <content>
- * id=two id=five id=twelve
- * data-color=blue data-color=purple select=secondSelect
- * <span> <content> <span>
- * id=three id=six id=thirteen
- * data-color=green select=firstSelect
- * <span>
- * id=seven
- * <content>
- * id=eight
- * <span>
- * id=nine
- * <span>
- * id=ten
- * data-color=grey
- */
-function constructTree(firstSelect, secondSelect) {
- var rootSpan = document.createElement("span");
- rootSpan.innerHTML = '<span id="one" data-color="red"></span><span id="two" data-color="blue"></span><span id="three" data-color="green"></span>';
- var firstShadow = rootSpan.createShadowRoot();
- firstShadow.innerHTML = '<span id="four" data-color="orange"><span id="five" data-color="purple"></span><content id="six" select="' + firstSelect + '"><span id="seven"></span><content id="eight"></content><span id="nine"></span></content><span id="ten"></span></span>';
- var secondShadow = firstShadow.firstChild.createShadowRoot();
- secondShadow.innerHTML = '<span id="eleven"></span><content id="twelve" select="' + secondSelect + '"></content><span id="thirteen"></span>';
- return rootSpan;
-}
-
-// Create a tree with content that matches on everything and check node distribution.
-var allSpan = constructTree("*", "*");
-var firstContent = allSpan.shadowRoot.getElementById("six");
-var firstDistNodes = firstContent.getDistributedNodes();
-is(firstDistNodes.length, 3, "Universal selector should match all nodes.");
-// Check the order of the distributed nodes.
-is(firstDistNodes.item(0).id, "one", "First distributed node should have id of 'one'");
-is(firstDistNodes.item(1).id, "two", "Second distributed node should have id of 'two'");
-is(firstDistNodes.item(2).id, "three", "Third distributed node should have id of 'three'");
-var secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
-var secondDistNodes = secondContent.getDistributedNodes();
-is(secondDistNodes.length, 5, "Universial selector should match all nodes including those distributed into content.");
-// Check the order of the distribute nodes.
-is(secondDistNodes.item(0).id, "five", "First distributed node should have id of 'five'");
-is(secondDistNodes.item(1).id, "one", "Second distributed (reprojected) node should have id of 'one'");
-is(secondDistNodes.item(2).id, "two", "Third distributed (reprojected) node should have id of 'two'");
-is(secondDistNodes.item(3).id, "three", "Fourth distributed (reprojected) node should have id of 'three'");
-is(secondDistNodes.item(4).id, "ten", "Fifth distributed node should have id of 'ten'");
-
-// Append an element after id=two and make sure that it is inserted into the corrent
-// position in the insertion points.
-var additionalSpan = document.createElement("span");
-additionalSpan.id = "additional";
-
-// Insert the additional span in the third position, before the span with id=three.
-allSpan.insertBefore(additionalSpan, allSpan.childNodes.item(2));
-firstDistNodes = firstContent.getDistributedNodes();
-secondDistNodes = secondContent.getDistributedNodes();
-is(firstDistNodes.length, 4, "First insertion point should match one more node.");
-is(firstDistNodes.item(2).id, "additional", "Additional span should have been inserted into the third position of the first insertion point.");
-
-is(secondDistNodes.length, 6, "Second insertion point should match one more node.");
-is(secondDistNodes.item(3).id, "additional", "Additional span should have been inserted into the fourth position of the second insertion point.");
-
-function nodeListDoesNotContain(nodeList, element) {
- for (var i = 0; i < nodeList.length; i++) {
- if (nodeList[i] == element) {
- return false;
- }
- }
- return true;
-}
-
-// Remove the span with id=one and check that it is removed from all insertion points.
-allSpan = constructTree("*", "*");
-var spanOne = allSpan.firstChild;
-allSpan.removeChild(spanOne);
-firstContent = allSpan.shadowRoot.getElementById("six");
-ok(nodeListDoesNotContain(firstContent.getDistributedNodes(), spanOne), "Child removed from host should not appear in insertion point node list.");
-secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
-ok(nodeListDoesNotContain(secondContent.getDistributedNodes(), spanOne), "Child removed from host should not appear in nested insertion point node list.");
-
-// Make sure <content> in fallback content is inactive.
-// First insertion point will not match anything and will use fallback content.
-allSpan = constructTree("#nomatch", "*");
-var fallbackInsertionPoint = allSpan.shadowRoot.getElementById("eight");
-is(fallbackInsertionPoint.getDistributedNodes().length, 0, "Insertion points in default content should be inactive.");
-
-// Insertion points with non-universal selectors.
-allSpan = constructTree("span[data-color=blue]", "*");
-firstContent = allSpan.shadowRoot.getElementById("six");
-is(firstContent.getDistributedNodes().length, 1, "Insertion point selector should only match one node.");
-is(firstContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector.");
-secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
-is(secondContent.getDistributedNodes().length, 3, "Second insertion point should match two children and one reprojected node.");
-is(secondContent.getDistributedNodes()[1].dataset.color, "blue", "Projected node should match selector.");
-
-allSpan = constructTree("span[data-color=blue]", "span[data-color=blue]");
-firstContent = allSpan.shadowRoot.getElementById("six");
-is(firstContent.getDistributedNodes().length, 1, "Insertion point selector should only match one node.");
-is(firstContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector.");
-secondContent = allSpan.shadowRoot.firstChild.shadowRoot.getElementById("twelve");
-is(secondContent.getDistributedNodes().length, 1, "Insertion point should only match reprojected node.");
-is(secondContent.getDistributedNodes()[0].dataset.color, "blue", "Projected node should match selector.");
-
-// Make sure that dynamically appended default content will get distributed.
-</script>
-</body>
-</html>
-