summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/nodes/Text-wholeText.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/dom/nodes/Text-wholeText.html
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/Text-wholeText.html')
-rw-r--r--testing/web-platform/tests/dom/nodes/Text-wholeText.html46
1 files changed, 46 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/Text-wholeText.html b/testing/web-platform/tests/dom/nodes/Text-wholeText.html
new file mode 100644
index 0000000000..2467930da8
--- /dev/null
+++ b/testing/web-platform/tests/dom/nodes/Text-wholeText.html
@@ -0,0 +1,46 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>Text - wholeText</title>
+<link rel=help href="https://dom.spec.whatwg.org/#dom-text-wholetext">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<script>
+"use strict";
+
+test(() => {
+ const parent = document.createElement("div");
+
+ const t1 = document.createTextNode("a");
+ const t2 = document.createTextNode("b");
+ const t3 = document.createTextNode("c");
+
+ assert_equals(t1.wholeText, t1.textContent);
+
+ parent.appendChild(t1);
+
+ assert_equals(t1.wholeText, t1.textContent);
+
+ parent.appendChild(t2);
+
+ assert_equals(t1.wholeText, t1.textContent + t2.textContent);
+ assert_equals(t2.wholeText, t1.textContent + t2.textContent);
+
+ parent.appendChild(t3);
+
+ assert_equals(t1.wholeText, t1.textContent + t2.textContent + t3.textContent);
+ assert_equals(t2.wholeText, t1.textContent + t2.textContent + t3.textContent);
+ assert_equals(t3.wholeText, t1.textContent + t2.textContent + t3.textContent);
+
+ const a = document.createElement("a");
+ a.textContent = "I'm an Anchor";
+ parent.insertBefore(a, t3);
+
+ const span = document.createElement("span");
+ span.textContent = "I'm a Span";
+ parent.appendChild(document.createElement("span"));
+
+ assert_equals(t1.wholeText, t1.textContent + t2.textContent);
+ assert_equals(t2.wholeText, t1.textContent + t2.textContent);
+ assert_equals(t3.wholeText, t3.textContent);
+}, "wholeText returns text of all Text nodes logically adjacent to the node, in document order.");
+</script>