1 <!-- Any copyright is dedicated to the Public Domain.
2 - http://creativecommons.org/publicdomain/zero/1.0/ -->
6 <title>Test USVString
</title>
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
8 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
11 <script class=
"testbody" type=
"application/javascript">
12 /* global TestInterfaceJS */
14 SimpleTest.waitForExplicitFinish();
15 SpecialPowers.pushPrefEnv({set: [[
"dom.expose_test_interfaces", true]]}, function() {
16 var testInterfaceJS = new TestInterfaceJS();
17 ok(testInterfaceJS,
"got a TestInterfaceJS object");
18 // For expected values, see algorithm definition here:
19 // http://heycam.github.io/webidl/#dfn-obtain-unicode
23 { string:
"This is U+2070E: \ud841\udf0e",
24 expected:
"This is U+2070E: \ud841\udf0e" },
25 { string:
"Missing low surrogate: \ud841",
26 expected:
"Missing low surrogate: \ufffd" },
27 { string:
"Missing low surrogate with trailer: \ud841!!",
28 expected:
"Missing low surrogate with trailer: \ufffd!!" },
29 { string:
"Missing high surrogate: \udf0e",
30 expected:
"Missing high surrogate: \ufffd" },
31 { string:
"Missing high surrogate with trailer: \udf0e!!",
32 expected:
"Missing high surrogate with trailer: \ufffd!!" },
33 { string:
"U+2070E after malformed: \udf0e\ud841\udf0e",
34 expected:
"U+2070E after malformed: \ufffd\ud841\udf0e" },
36 testList.forEach(function(test) {
37 is(testInterfaceJS.convertSVS(test.string), test.expected,
"Convert '" + test.string +
"'");