summaryrefslogtreecommitdiffstats
path: root/dom/bindings/test/test_usvstring.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /dom/bindings/test/test_usvstring.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/bindings/test/test_usvstring.html')
-rw-r--r--dom/bindings/test/test_usvstring.html43
1 files changed, 43 insertions, 0 deletions
diff --git a/dom/bindings/test/test_usvstring.html b/dom/bindings/test/test_usvstring.html
new file mode 100644
index 0000000000..bef4d5e1fa
--- /dev/null
+++ b/dom/bindings/test/test_usvstring.html
@@ -0,0 +1,43 @@
+<!-- Any copyright is dedicated to the Public Domain.
+ - http://creativecommons.org/publicdomain/zero/1.0/ -->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test USVString</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="application/javascript">
+/* global TestInterfaceJS */
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, function() {
+ var testInterfaceJS = new TestInterfaceJS();
+ ok(testInterfaceJS, "got a TestInterfaceJS object");
+ // For expected values, see algorithm definition here:
+ // http://heycam.github.io/webidl/#dfn-obtain-unicode
+ var testList = [
+ { string: "foo",
+ expected: "foo" },
+ { string: "This is U+2070E: \ud841\udf0e",
+ expected: "This is U+2070E: \ud841\udf0e" },
+ { string: "Missing low surrogate: \ud841",
+ expected: "Missing low surrogate: \ufffd" },
+ { string: "Missing low surrogate with trailer: \ud841!!",
+ expected: "Missing low surrogate with trailer: \ufffd!!" },
+ { string: "Missing high surrogate: \udf0e",
+ expected: "Missing high surrogate: \ufffd" },
+ { string: "Missing high surrogate with trailer: \udf0e!!",
+ expected: "Missing high surrogate with trailer: \ufffd!!" },
+ { string: "U+2070E after malformed: \udf0e\ud841\udf0e",
+ expected: "U+2070E after malformed: \ufffd\ud841\udf0e" },
+ ];
+ testList.forEach(function(test) {
+ is(testInterfaceJS.convertSVS(test.string), test.expected, "Convert '" + test.string + "'");
+ });
+ SimpleTest.finish();
+});
+</script>
+</body>
+</html>