diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/dom/nodes/CharacterData-surrogates.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/nodes/CharacterData-surrogates.html')
-rw-r--r-- | testing/web-platform/tests/dom/nodes/CharacterData-surrogates.html | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/nodes/CharacterData-surrogates.html b/testing/web-platform/tests/dom/nodes/CharacterData-surrogates.html new file mode 100644 index 0000000000..ff1014c5fd --- /dev/null +++ b/testing/web-platform/tests/dom/nodes/CharacterData-surrogates.html @@ -0,0 +1,74 @@ +<!DOCTYPE html> +<meta charset=utf-8> +<title>Splitting and joining surrogate pairs in CharacterData methods</title> +<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-substringdata"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-replacedata"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-insertdata"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-deletedata"> +<link rel=help href="https://dom.spec.whatwg.org/#dom-characterdata-data"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<div id="log"></div> +<script> +function testNode(create, type) { + test(function() { + var node = create() + assert_equals(node.data, "test") + + node.data = "🌠test 🌠TEST" + + assert_equals(node.substringData(1, 8), "\uDF20 test \uD83C") + }, type + ".substringData() splitting surrogate pairs") + + test(function() { + var node = create() + assert_equals(node.data, "test") + + node.data = "🌠test 🌠TEST" + + node.replaceData(1, 4, "--"); + assert_equals(node.data, "\uD83C--st 🌠TEST"); + + node.replaceData(1, 2, "\uDF1F "); + assert_equals(node.data, "🌟 st 🌠TEST"); + + node.replaceData(5, 2, "---"); + assert_equals(node.data, "🌟 st---\uDF20 TEST"); + + node.replaceData(6, 2, " \uD83D"); + assert_equals(node.data, "🌟 st- 🜠TEST"); + }, type + ".replaceData() splitting and creating surrogate pairs") + + test(function() { + var node = create() + assert_equals(node.data, "test") + + node.data = "🌠test 🌠TEST" + + node.deleteData(1, 4); + assert_equals(node.data, "\uD83Cst 🌠TEST"); + + node.deleteData(1, 4); + assert_equals(node.data, "🌠TEST"); + }, type + ".deleteData() splitting and creating surrogate pairs") + + test(function() { + var node = create() + assert_equals(node.data, "test") + + node.data = "🌠test 🌠TEST" + + node.insertData(1, "--"); + assert_equals(node.data, "\uD83C--\uDF20 test 🌠TEST"); + + node.insertData(1, "\uDF1F "); + assert_equals(node.data, "🌟 --\uDF20 test 🌠TEST"); + + node.insertData(5, " \uD83D"); + assert_equals(node.data, "🌟 -- 🜠test 🌠TEST"); + }, type + ".insertData() splitting and creating surrogate pairs") +} + +testNode(function() { return document.createTextNode("test") }, "Text") +testNode(function() { return document.createComment("test") }, "Comment") +</script> |