summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/selection/shadow-dom
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/selection/shadow-dom')
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1-ref.html6
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1.html10
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2-ref.html7
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2.html11
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3-ref.html12
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3.html17
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-4.html21
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5-ref.html13
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5.html20
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6-ref.html12
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6.html44
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img-ref.html9
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img.html26
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document-ref.html9
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document.html12
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root-ref.html11
-rw-r--r--testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root.html24
17 files changed, 264 insertions, 0 deletions
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1-ref.html
new file mode 100644
index 0000000000..9cc7affd67
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1-ref.html
@@ -0,0 +1,6 @@
+<!doctype html>
+OuterText
+<div>innerText</div>
+<script>
+ getSelection().selectAllChildren(document.body);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1.html
new file mode 100644
index 0000000000..58d7e9f8e4
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-1.html
@@ -0,0 +1,10 @@
+<!doctype html>
+<head>
+<link rel="match" href="cross-shadow-boundary-1-ref.html"/>
+</head>
+OuterText
+<div id="host"></div>
+<script>
+ document.getElementById("host").attachShadow({mode: "open"}).innerHTML = "innerText";
+ getSelection().selectAllChildren(document.body);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2-ref.html
new file mode 100644
index 0000000000..c9e0068c51
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2-ref.html
@@ -0,0 +1,7 @@
+<!doctype html>
+OuterText
+<div>innerText</div>
+OuterText
+<script>
+ getSelection().selectAllChildren(document.body);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2.html
new file mode 100644
index 0000000000..e0d3a14f48
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-2.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<head>
+<link rel="match" href="cross-shadow-boundary-2-ref.html" />
+</head>
+OuterText
+<div id="host"></div>
+OuterText
+<script>
+ document.getElementById("host").attachShadow({ mode: "open" }).innerHTML = "innerText";
+ getSelection().selectAllChildren(document.body);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3-ref.html
new file mode 100644
index 0000000000..189ab35c41
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3-ref.html
@@ -0,0 +1,12 @@
+<!doctype html>
+OuterText
+<div id="host1">innerText1</div>
+OuterText
+<div id="host2">innerText2</div>
+<script>
+ const host1 = document.getElementById("host1");
+ const host2 = document.getElementById("host2");
+
+ getSelection().setBaseAndExtent(
+ host1.firstChild, 3, host2.firstChild, 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3.html
new file mode 100644
index 0000000000..3eb2ab37b1
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-3.html
@@ -0,0 +1,17 @@
+<!doctype html>
+<head>
+<link rel="match" href="cross-shadow-boundary-3-ref.html" />
+</head>
+OuterText
+<div id="host1"></div>
+OuterText
+<div id="host2"></div>
+<script>
+ const root1 = document.getElementById("host1").attachShadow({ mode: "open" });
+ root1.innerHTML = "innerText1";
+
+ const root2 = document.getElementById("host2").attachShadow({ mode: "open" });
+ root2.innerHTML = "innerText2";
+
+ getSelection().setBaseAndExtent(root1.firstChild, 3, root2.firstChild, 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-4.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-4.html
new file mode 100644
index 0000000000..a93bf77aaa
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-4.html
@@ -0,0 +1,21 @@
+<!doctype html>
+<head>
+<!--Intentionally to use cross-shadow-boundary-3-ref.html here-->
+<link rel=match href="cross-shadow-boundary-3-ref.html">
+</head>
+OuterText
+<div id="host1"></div>
+OuterText
+<div id="host2"></div>
+<script>
+ const root1 = document.getElementById("host1").attachShadow({ mode: "open" });
+ root1.innerHTML = "innerText1";
+
+ const root2 = document.getElementById("host2").attachShadow({ mode: "open" });
+ root2.innerHTML = "<div></div>";
+
+ const root3 = root2.querySelector("div").attachShadow({ mode: "open" });
+ root3.innerHTML = "innerText2";
+
+ getSelection().setBaseAndExtent(root1.firstChild, 3, root3.firstChild, 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5-ref.html
new file mode 100644
index 0000000000..2abfd911ec
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5-ref.html
@@ -0,0 +1,13 @@
+<!doctype html>
+OuterText1
+<div>innerText1</div>
+OuterText2
+<div>innerText2</div>
+OuterText3
+<script>
+ getSelection().setBaseAndExtent(
+ document.body.firstChild,
+ 3,
+ document.body.childNodes[4],
+ 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5.html
new file mode 100644
index 0000000000..75c0525ade
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-5.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<head>
+<link rel=match href="cross-shadow-boundary-5-ref.html">
+</head>
+OuterText1
+<div id="host1"></div>
+OuterText2
+<div id="host2"></div>
+OuterText3
+<script>
+ const root1 = document.getElementById("host1").attachShadow({ mode: "open" });
+ root1.innerHTML = "innerText1";
+
+ const root2 = document.getElementById("host2").attachShadow({ mode: "open" });
+ root2.innerHTML = "<div></div>";
+
+ const root3 = root2.querySelector("div").attachShadow({ mode: "open" });
+ root3.innerHTML = "innerText2";
+ getSelection().setBaseAndExtent(document.body.firstChild, 3, document.body.childNodes[4], 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6-ref.html
new file mode 100644
index 0000000000..b7441c7bbc
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6-ref.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<span id="span">Start
+<div>
+ <span id="inner1">inner1</p>
+ <span id="inner2">inner2</p>
+</div>
+</span>
+<script>
+ const start = document.getElementById("span").firstChild;
+ const end = document.getElementById("inner2");
+ window.getSelection().setBaseAndExtent(start, 3, end.firstChild, 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6.html
new file mode 100644
index 0000000000..cc264a6668
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-6.html
@@ -0,0 +1,44 @@
+<!doctype html>
+<html class="reftest-wait">
+<head>
+<link rel=match href="cross-shadow-boundary-6-ref.html">
+</head>
+<span id="span">Start
+<div>
+ <template shadowrootmode="open">
+ <span id="inner1">inner1</p>
+ <span id="inner2">inner2</p>
+ </template>
+</div>
+</span>
+<script>
+ const start = document.getElementById("span").firstChild;
+ const end = document.querySelector('div').shadowRoot.getElementById("inner2");
+
+ async function waitForRAFs() {
+ return new Promise(resolve => {
+ window.requestAnimationFrame(() => {
+ window.requestAnimationFrame(() => {
+ window.requestAnimationFrame(() => {
+ resolve();
+ });
+ });
+ });
+ });
+ }
+
+ async function runTest() {
+ window.getSelection().setBaseAndExtent(start, 3, end.firstChild, 3);
+ await waitForRAFs();
+
+ window.getSelection().removeAllRanges();
+ await waitForRAFs();
+
+ window.getSelection().setBaseAndExtent(start, 3, end.firstChild, 3);
+ await waitForRAFs();
+ document.documentElement.className = "";
+ }
+
+ runTest();
+</script>
+</html>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img-ref.html
new file mode 100644
index 0000000000..7f3b03ace6
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img-ref.html
@@ -0,0 +1,9 @@
+<!doctype html>
+OuterText1
+<div>innerText1</div>
+OuterText2
+<div><img style="width: 10px; height: 10px; background-color: black"></img></div>
+OuterText3
+<script>
+ getSelection().setBaseAndExtent(document.body.firstChild, 3, document.body.childNodes[4], 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img.html
new file mode 100644
index 0000000000..46e8d70833
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-img.html
@@ -0,0 +1,26 @@
+<!doctype html>
+<head>
+<link rel=match href="cross-shadow-boundary-img-ref.html">
+</head>
+OuterText1
+<div id="host1"></div>
+OuterText2
+<div id="host2"></div>
+OuterText3
+<script>
+ const root1 = document.getElementById("host1").attachShadow({ mode: "open" });
+ root1.innerHTML = "innerText1";
+
+ const root2 = document.getElementById("host2").attachShadow({ mode: "open" });
+ root2.innerHTML = "<div></div>";
+
+ const root3 = root2.querySelector("div").attachShadow({ mode: "open" });
+ root3.innerHTML = "<img>";
+
+ const img = root3.querySelector("img");
+ img.style.width = "10px";
+ img.style.height = "10px";
+ img.style.backgroundColor = "black";
+
+ getSelection().setBaseAndExtent(document.body.firstChild, 3, document.body.childNodes[4], 3);
+</script>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document-ref.html
new file mode 100644
index 0000000000..0312000bc0
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document-ref.html
@@ -0,0 +1,9 @@
+<!doctype html>
+<html>
+ <div>CONTENT</div>
+ <script>
+ const div = document.querySelector("div");
+ getSelection().setBaseAndExtent(div.firstChild, 0, div.firstChild, 2);
+ </script>
+</html>
+
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document.html
new file mode 100644
index 0000000000..9eb298abbf
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-document.html
@@ -0,0 +1,12 @@
+<!doctype html>
+<html>
+ <head>
+ <link rel=match href="cross-shadow-boundary-select-document-ref.html">
+ </head>
+ <div></div>
+ <script>
+ const root = document.querySelector("div").attachShadow({mode: "open"});
+ root.innerHTML = "CONTENT";
+ getSelection().setBaseAndExtent(document, 0, root.firstChild, 2);
+ </script>
+</html>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root-ref.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root-ref.html
new file mode 100644
index 0000000000..fe74406acd
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root-ref.html
@@ -0,0 +1,11 @@
+<!doctype html>
+<html>
+ <body>
+ <div id="outerText">OuterText1</div>
+ <div>InnerText1</div>
+ <div>OuterText2</div>
+ <div id="host">InnerText2</div>
+ <script>
+ window.getSelection().setBaseAndExtent(outerText, 0, host, host.childNodes.length);
+ </script>
+</body></html>
diff --git a/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root.html b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root.html
new file mode 100644
index 0000000000..f64dd0f3b0
--- /dev/null
+++ b/testing/web-platform/tests/selection/shadow-dom/cross-shadow-boundary-select-root.html
@@ -0,0 +1,24 @@
+<!doctype html>
+<head>
+<link rel=match href="cross-shadow-boundary-select-root-ref.html">
+</head>
+<div id="outerText1">OuterText1</div>
+<div id="host1"></div>
+<div id="outerText2">OuterText2</div>
+<div id="host2"></div>
+<div id="host3"></div>
+<script>
+ const outerText1 = document.getElementById("outerText1");
+ const outerText2 = document.getElementById("outerText2");
+
+ const host1 = document.getElementById("host1");
+ const root1 = host1.attachShadow({mode: "open"});
+ root1.innerHTML = "InnerText1";
+
+ const host2 = document.getElementById("host2");
+ const root2 = host2.attachShadow({mode: "open"});
+ root2.innerHTML = "InnerText2";
+
+ getSelection().setBaseAndExtent(outerText1, 0, root2, root2.childNodes.length);
+</script>
+