(input, expected, desc)
| 5 | // expect (function) |
| 6 | |
| 7 | function encode(input, expected, desc) { |
| 8 | // tests whether a Unicode character is converted to an equivalent byte sequence by href |
| 9 | // input: a Unicode character |
| 10 | // expected: expected byte sequence |
| 11 | // desc: what's being tested |
| 12 | subsetTest(test, function() { |
| 13 | var a = document.createElement("a"); // <a> uses document encoding for URL's query |
| 14 | a.href = "https://example.com/?" + input; |
| 15 | result = a.search.substr(1); // remove leading "?" |
| 16 | assert_equals(normalizeStr(result), normalizeStr(expected)); |
| 17 | }, desc); |
| 18 | } |
| 19 | |
| 20 | // set up a simple array of unicode codepoints that are not encoded |
| 21 | var codepoints = []; |
no test coverage detected