2014-08-02 00:23:48 +04:00
|
|
|
<!-- Any copyright is dedicated to the Public Domain.
|
|
|
|
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
2014-11-20 14:58:00 +03:00
|
|
|
<title>Test USVString</title>
|
2019-04-16 06:53:28 +03:00
|
|
|
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
2014-08-02 00:23:48 +04:00
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script class="testbody" type="application/javascript">
|
2019-03-29 19:47:06 +03:00
|
|
|
/* global TestInterfaceJS */
|
|
|
|
|
2014-08-02 00:23:48 +04:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
2019-03-28 12:11:04 +03:00
|
|
|
SpecialPowers.pushPrefEnv({set: [["dom.expose_test_interfaces", true]]}, function() {
|
2014-08-02 00:23:48 +04:00
|
|
|
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",
|
2019-03-28 12:11:04 +03:00
|
|
|
expected: "U+2070E after malformed: \ufffd\ud841\udf0e" },
|
2014-08-02 00:23:48 +04:00
|
|
|
];
|
|
|
|
testList.forEach(function(test) {
|
|
|
|
is(testInterfaceJS.convertSVS(test.string), test.expected, "Convert '" + test.string + "'");
|
|
|
|
});
|
|
|
|
SimpleTest.finish();
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
|
|
</html>
|