summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/dom/elements/global-attributes
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/html/dom/elements/global-attributes')
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js5
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-dataChange.html31
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-ref.html13
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-replace.html32
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-textContent.html31
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html2
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html25
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html33
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html6
-rw-r--r--testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN.html4
10 files changed, 174 insertions, 8 deletions
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js
index 0d4e4b82d9..2017269f0b 100644
--- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-assorted.window.js
@@ -90,10 +90,11 @@ for (const bdi_test of [
{ markup: "<bdi dir=rtl></bdi>", expected: "rtl", desc: "dir=rtl empty" },
{ markup: "<bdi dir=auto>A</bdi>", expected: "ltr", desc: "dir=auto with LTR contents" },
{ markup: "<bdi dir=auto>\u05d0</bdi>", expected: "rtl", desc: "dir=auto with RTL contents" },
- { markup: "<bdi dir=auto></bdi>", expected: "parent", desc: "dir=auto empty" },
+ { markup: "<bdi dir=auto></bdi>", expected: "ltr", desc: "dir=auto empty" },
+ { markup: "<bdi dir=auto>123</bdi>", expected: "ltr", desc: "dir=auto numbers" },
{ markup: "<bdi>A</bdi>", expected: "ltr", desc: "no dir attribute with LTR contents" },
{ markup: "<bdi>\u05d0</bdi>", expected: "rtl", desc: "no dir attribute with RTL contents" },
- { markup: "<bdi></bdi>", expected: "parent", desc: "no dir attribute empty" },
+ { markup: "<bdi></bdi>", expected: "ltr", desc: "no dir attribute empty" },
]) {
for (const parent_dir of [ "ltr", "rtl" ]) {
test(() => {
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-dataChange.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-dataChange.html
new file mode 100644
index 0000000000..ded136a3ae
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-dataChange.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset="utf-8">
+<title>Dynamic changes with textContent and dir=auto</title>
+<link rel="match" href="dir-auto-dynamic-simple-ref.html">
+<div>Test for elements with dir="auto" whose content changes between directional and neutral</div>
+<div dir="auto" id="from_ltr_to_ltr">abc</div>
+<div dir="auto" id="from_ltr_to_rtl">abc</div>
+<div dir="auto" id="from_ltr_to_neutral">abc</div>
+<div dir="auto" id="from_rtl_to_ltr">אבג</div>
+<div dir="auto" id="from_rtl_to_rtl">אבג</div>
+<div dir="auto" id="from_rtl_to_neutral">אבג</div>
+<div dir="auto" id="from_neutral_to_ltr">123</div>
+<div dir="auto" id="from_neutral_to_rtl">123</div>
+<div dir="auto" id="from_neutral_to_neutral">123</div>
+<script>
+function changeContent() {
+ var directionalTexts = {ltr:"xyz", rtl:"ابج", neutral:"456"};
+
+ for (var dirFrom in directionalTexts) {
+ for (var dirTo in directionalTexts) {
+ var element = document.getElementById("from_" + dirFrom +
+ "_to_" + dirTo);
+ element.firstChild.data = directionalTexts[dirTo];
+ }
+ }
+ document.documentElement.removeAttribute("class");
+}
+
+document.addEventListener("TestRendered", changeContent);
+</script>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-ref.html
new file mode 100644
index 0000000000..5a9a2f2484
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-ref.html
@@ -0,0 +1,13 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Dynamic changes and dir=auto</title>
+<div>Test for elements with dir="auto" whose content changes between directional and neutral</div>
+<div dir="auto">xyz</div>
+<div dir="auto">ابج</div>
+<div dir="auto">456</div>
+<div dir="auto">xyz</div>
+<div dir="auto">ابج</div>
+<div dir="auto">456</div>
+<div dir="auto">xyz</div>
+<div dir="auto">ابج</div>
+<div dir="auto">456</div>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-replace.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-replace.html
new file mode 100644
index 0000000000..6d785f08b8
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-replace.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset="utf-8">
+<title>Dynamic changes with textContent and dir=auto</title>
+<link rel="match" href="dir-auto-dynamic-simple-ref.html">
+<div>Test for elements with dir="auto" whose content changes between directional and neutral</div>
+<div dir="auto" id="from_ltr_to_ltr">abc</div>
+<div dir="auto" id="from_ltr_to_rtl">abc</div>
+<div dir="auto" id="from_ltr_to_neutral">abc</div>
+<div dir="auto" id="from_rtl_to_ltr">אבג</div>
+<div dir="auto" id="from_rtl_to_rtl">אבג</div>
+<div dir="auto" id="from_rtl_to_neutral">אבג</div>
+<div dir="auto" id="from_neutral_to_ltr">123</div>
+<div dir="auto" id="from_neutral_to_rtl">123</div>
+<div dir="auto" id="from_neutral_to_neutral">123</div>
+<script>
+function changeContent() {
+ var directionalTexts = {ltr:"xyz", rtl:"ابج", neutral:"456"};
+
+ for (var dirFrom in directionalTexts) {
+ for (var dirTo in directionalTexts) {
+ var element = document.getElementById("from_" + dirFrom +
+ "_to_" + dirTo);
+ element.firstChild.remove();
+ element.appendChild(document.createTextNode(directionalTexts[dirTo]));
+ }
+ }
+ document.documentElement.removeAttribute("class");
+}
+
+document.addEventListener("TestRendered", changeContent);
+</script>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-textContent.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-textContent.html
new file mode 100644
index 0000000000..3b644908ab
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-auto-dynamic-simple-textContent.html
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<meta charset="utf-8">
+<title>Dynamic changes with textContent and dir=auto</title>
+<link rel="match" href="dir-auto-dynamic-simple-ref.html">
+<div>Test for elements with dir="auto" whose content changes between directional and neutral</div>
+<div dir="auto" id="from_ltr_to_ltr">abc</div>
+<div dir="auto" id="from_ltr_to_rtl">abc</div>
+<div dir="auto" id="from_ltr_to_neutral">abc</div>
+<div dir="auto" id="from_rtl_to_ltr">אבג</div>
+<div dir="auto" id="from_rtl_to_rtl">אבג</div>
+<div dir="auto" id="from_rtl_to_neutral">אבג</div>
+<div dir="auto" id="from_neutral_to_ltr">123</div>
+<div dir="auto" id="from_neutral_to_rtl">123</div>
+<div dir="auto" id="from_neutral_to_neutral">123</div>
+<script>
+function changeContent() {
+ var directionalTexts = {ltr:"xyz", rtl:"ابج", neutral:"456"};
+
+ for (var dirFrom in directionalTexts) {
+ for (var dirTo in directionalTexts) {
+ var element = document.getElementById("from_" + dirFrom +
+ "_to_" + dirTo);
+ element.textContent = directionalTexts[dirTo];
+ }
+ }
+ document.documentElement.removeAttribute("class");
+}
+
+document.addEventListener("TestRendered", changeContent);
+</script>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html
index b52e08df20..79b844edbe 100644
--- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-41-ref.html
@@ -18,7 +18,7 @@ span {border: 1px solid silver;}
<p>`dir=rtl` on a div in the shadow tree, `dir=ltr` on the shadow host, no slotted text in the light or dark trees</p>
<div id="host" dir="ltr"><div dir="rtl"><span></span></div></div>
-<p id="result">The HTML direction / computed CSS `direction` value is: rtl / rtl (on the slot).</p>
+<p id="result">The HTML direction / computed CSS `direction` value is: ltr / ltr (on the slot).</p>
</body>
</html>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html
new file mode 100644
index 0000000000..8ea1100246
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42-ref.html
@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>[dir] and shadow slots: dir=ltr on a div in the shadow tree, dir=rtl on the shadow host, no slotted text in the light or dark trees</title>
+<link rel="author" title="Eric Meyer" href="mailto:emeyer@igalia.com">
+<link rel="author" title="L. David Baron" href="mailto:dbaron@chromium.org">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/C#the-dir-attribute">
+<link rel="help" href="https://github.com/whatwg/html/issues/3699">
+<link rel="help" href="https://github.com/whatwg/html/pull/9796">
+<style type="text/css">
+body {width: 600px;}
+#host {border: 1px solid gray; margin: 1em; padding: 0.25em;}
+span {border: 1px solid silver;}
+
+</style>
+</head>
+<body>
+
+<p>`dir=ltr` on a div in the shadow tree, `dir=rtl` on the shadow host, no slotted text in the light or dark trees</p>
+<div id="host" dir="rtl"><div dir="ltr"><span></span></div></div>
+<p id="result">The HTML direction / computed CSS `direction` value is: ltr / ltr (on the slot).</p>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html
new file mode 100644
index 0000000000..b9697678cb
--- /dev/null
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir-shadow-42.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<html>
+<head>
+<meta charset="utf-8"/>
+<title>[dir] and shadow slots: dir=ltr on a div in the shadow tree, dir=rtl on the shadow host, no slotted text in the light or dark trees</title>
+<link rel="author" title="Eric Meyer" href="mailto:emeyer@igalia.com">
+<link rel="author" title="L. David Baron" href="mailto:dbaron@chromium.org">
+<link rel="help" href="https://html.spec.whatwg.org/multipage/C#the-dir-attribute">
+<link rel="help" href="https://github.com/whatwg/html/issues/3699">
+<link rel="help" href="https://github.com/whatwg/html/pull/9796">
+<link rel="match" href="dir-shadow-42-ref.html">
+<style type="text/css">
+body {width: 600px;}
+#host {border: 1px solid gray; margin: 1em; padding: 0.25em;}
+span {border: 1px solid silver;}
+
+</style>
+<script src="dir-shadow-utils.js"></script>
+</head>
+<body>
+
+<p>`dir=ltr` on a div in the shadow tree, `dir=rtl` on the shadow host, no slotted text in the light or dark trees</p>
+<div id="host" dir="rtl"><span slot="x1"></span></div>
+<p id="result">The HTML direction / computed CSS `direction` value is: </p>
+
+<script type="text/javascript">
+ let root = host.attachShadow({mode:"open"});
+ root.innerHTML = `<div dir="ltr"><slot dir="auto" name="x1"></slot></div>`;
+ result.innerHTML += html_direction(root.querySelector("div[dir=ltr]").firstChild) + " / " + getComputedStyle(root.querySelector("div[dir=ltr]").firstChild).direction + " (on the " + root.querySelector("div[dir=ltr]").firstChild.localName + ').';
+</script>
+
+</body>
+</html>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html
index 0d938b2e16..496d699d73 100644
--- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN-ref.html
@@ -10,7 +10,7 @@
<meta name="assert" content="
When dir='auto', the direction is set according to the first strong character
of the text, ignoring neutrals and numbers.
- If there is no strong character, as in this test, the direction defaults to the parent." />
+ If there is no strong character, as in this test, the direction defaults to LTR." />
<style>
input, textarea {
font-size:1em;
@@ -35,7 +35,7 @@
<p dir="ltr">@123!</p>
</div>
<div dir="rtl">
- <p dir="rtl">@123!</p>
+ <p dir="ltr">@123!</p>
</div>
</div>
<div class="ref">
@@ -43,7 +43,7 @@
<p dir="ltr">@123!</p>
</div>
<div dir="rtl">
- <p dir="rtl">@123!</p>
+ <p dir="ltr">@123!</p>
</div>
</div>
</body>
diff --git a/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN.html b/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN.html
index 467b4d0939..5d948d3456 100644
--- a/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN.html
+++ b/testing/web-platform/tests/html/dom/elements/global-attributes/dir_auto-N-EN.html
@@ -11,7 +11,7 @@
<meta name="assert" content="
When dir='auto', the direction is set according to the first strong character
of the text, ignoring neutrals and numbers.
- If there is no strong character, as in this test, the direction defaults to the parent." />
+ If there is no strong character, as in this test, the direction defaults to LTR." />
<style>
input, textarea {
font-size:1em;
@@ -44,7 +44,7 @@
<p dir="ltr">@123!</p>
</div>
<div dir="rtl">
- <p dir="rtl">@123!</p>
+ <p dir="ltr">@123!</p>
</div>
</div>
</body>