1 description("Tests mailto: URL canonicalization");
5 ["addr1@foo.com", "addr1@foo.com"],
7 // Trailing whitespace is stripped.
8 ["addr1 \t ", "addr1"],
9 ["addr1?to=jon", "addr1?to=jon"],
10 ["addr1,addr2", "addr1,addr2"],
11 ["addr1, addr2", "addr1, addr2"],
12 ["addr1%2caddr2", "addr1%2caddr2"],
14 // U+10300 input as UTF-16 surrogate pair, expected as escaped UTF-8
15 ["\uD800\uDF00", "%F0%90%8C%80"],
18 // Null character should be escaped to %00
19 // Not sure how to test null characters in JavaScript. They appear to get
21 // ["addr1\\0addr2?foo", "addr1%00addr2?foo"],
24 for (var i
= 0; i
< cases
.length
; ++i
) {
25 shouldBe("canonicalize('mailto:" + cases
[i
][0] + "')",
26 "'mailto:" + cases
[i
][1] + "'");
28 // Invalid -- UTF-8 encoded surrogate value.
29 shouldBeFalse("canonicalize('mailto:\xed\xa0\x80') == 'mailto:%EF%BF%BD'");