diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /testing/web-platform/tests/html/semantics/document-metadata/the-title-element | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/html/semantics/document-metadata/the-title-element')
4 files changed, 124 insertions, 0 deletions
diff --git a/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-01.html b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-01.html new file mode 100644 index 0000000000..7f25400ea8 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-01.html @@ -0,0 +1,25 @@ +<!DOCTYPE html> +<title>title.text with comment and element children.</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +try { + var title = document.getElementsByTagName("title")[0]; + while (title.childNodes.length) + title.removeChild(title.childNodes[0]); + title.appendChild(document.createComment("COMMENT")); + title.appendChild(document.createTextNode("TEXT")); + title.appendChild(document.createElement("a")) + .appendChild(document.createTextNode("ELEMENT")) +} catch (e) { +} +</script> +<script> +test(function() { + assert_equals(title.text, "TEXT"); + assert_equals(title.textContent, "TEXTELEMENT"); +}) +</script> diff --git a/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-02.xhtml b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-02.xhtml new file mode 100644 index 0000000000..068b105046 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-02.xhtml @@ -0,0 +1,30 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title>title.text with comment and element children.</title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +try { + var title = document.getElementsByTagName("title")[0]; + while (title.childNodes.length) + title.removeChild(title.childNodes[0]); + title.appendChild(document.createComment("COMMENT")); + title.appendChild(document.createTextNode("TEXT")); + title.appendChild(document.createElement("a")) + .appendChild(document.createTextNode("ELEMENT")) +} catch (e) { +} +</script> +<script> +test(function() { + assert_equals(title.text, "TEXT"); + assert_equals(title.textContent, "TEXTELEMENT"); +}) +</script> +</body> +</html> diff --git a/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-03.html b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-03.html new file mode 100644 index 0000000000..1c119a825c --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-03.html @@ -0,0 +1,32 @@ +<!DOCTYPE html> +<title> title.text and space normalization </title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +test(function() { + assert_equals(document.getElementsByTagName("title")[0].text, + " title.text and space normalization "); + assert_equals(document.getElementsByTagName("title")[0].textContent, + " title.text and space normalization "); + assert_equals(document.getElementsByTagName("title")[0].firstChild.nodeValue, + " title.text and space normalization "); +}, "title.text and space normalization (markup)"); +[ + "one space", "two spaces", + "one\ttab", "two\t\ttabs", + "one\nnewline", "two\n\nnewlines", + "one\fform feed", "two\f\fform feeds", + "one\rcarriage return", "two\r\rcarriage returns" +].forEach(function(str) { + test(function() { + document.title = str; + var title = document.getElementsByTagName("title")[0]; + assert_equals(title.text, str); + assert_equals(title.textContent, str); + assert_equals(title.firstChild.nodeValue, str); + }, "title.text and space normalization: " + format_value(str)) +}); +</script> diff --git a/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-04.xhtml b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-04.xhtml new file mode 100644 index 0000000000..de382ab4d5 --- /dev/null +++ b/testing/web-platform/tests/html/semantics/document-metadata/the-title-element/title.text-04.xhtml @@ -0,0 +1,37 @@ +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<title> title.text and space normalization </title> +<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com"/> +<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-title-text"/> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +</head> +<body> +<div id="log"></div> +<script> +test(function() { + assert_equals(document.getElementsByTagName("title")[0].text, + " title.text and space normalization "); + assert_equals(document.getElementsByTagName("title")[0].textContent, + " title.text and space normalization "); + assert_equals(document.getElementsByTagName("title")[0].firstChild.nodeValue, + " title.text and space normalization "); +}, "title.text and space normalization (markup)"); +[ + "one space", "two spaces", + "one\ttab", "two\t\ttabs", + "one\nnewline", "two\n\nnewlines", + "one\fform feed", "two\f\fform feeds", + "one\rcarriage return", "two\r\rcarriage returns" +].forEach(function(str) { + test(function() { + document.title = str; + var title = document.getElementsByTagName("title")[0]; + assert_equals(title.text, str); + assert_equals(title.textContent, str); + assert_equals(title.firstChild.nodeValue, str); + }, "title.text and space normalization: " + format_value(str)) +}); +</script> +</body> +</html> |