OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../resources/js-test.js"></script> | 4 <script src="../resources/js-test.js"></script> |
5 </head> | 5 </head> |
6 <body> | 6 <body> |
7 <script> | 7 <script> |
8 // Test from https://github.com/mathiasbynens/CSS.escape | 8 // Test from https://github.com/mathiasbynens/CSS.escape |
9 description("Test window.CSS.escape()"); | 9 description("Test window.CSS.escape()"); |
10 | 10 |
11 shouldThrow("CSS.escape('\0')"); | 11 shouldBeEqualToString("CSS.escape('\0')", "\ufffd"); |
12 shouldThrow("CSS.escape('a\0')"); | 12 shouldBeEqualToString("CSS.escape('a\0')", "a\ufffd"); |
13 shouldThrow("CSS.escape('\0b')"); | 13 shouldBeEqualToString("CSS.escape('\0b')", "\ufffdb"); |
14 shouldThrow("CSS.escape('a\0b')"); | 14 shouldBeEqualToString("CSS.escape('a\0b')", "a\ufffdb"); |
| 15 |
| 16 shouldBeEqualToString("CSS.escape('\ufffd')", "\ufffd"); |
| 17 shouldBeEqualToString("CSS.escape('a\ufffd')", "a\ufffd"); |
| 18 shouldBeEqualToString("CSS.escape('\ufffdb')", "\ufffdb"); |
| 19 shouldBeEqualToString("CSS.escape('a\ufffdb')", "a\ufffdb"); |
15 | 20 |
16 shouldThrow("CSS.escape()"); | 21 shouldThrow("CSS.escape()"); |
17 shouldBeEqualToString("CSS.escape(true)", "true"); | 22 shouldBeEqualToString("CSS.escape(true)", "true"); |
18 shouldBeEqualToString("CSS.escape(false)", "false"); | 23 shouldBeEqualToString("CSS.escape(false)", "false"); |
19 shouldBeEqualToString("CSS.escape(null)", "null"); | 24 shouldBeEqualToString("CSS.escape(null)", "null"); |
20 shouldBeEqualToString("CSS.escape('')", ""); | 25 shouldBeEqualToString("CSS.escape('')", ""); |
21 | 26 |
22 shouldBeEqualToString("CSS.escape('\x01\x02\x1E\x1F')", "\\1 \\2 \\1e \\1f "
); | 27 shouldBeEqualToString("CSS.escape('\x01\x02\x1E\x1F')", "\\1 \\2 \\1e \\1f "
); |
23 | 28 |
24 shouldBeEqualToString("CSS.escape('0a')", "\\30 a"); | 29 shouldBeEqualToString("CSS.escape('0a')", "\\30 a"); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 shouldBeEqualToString("CSS.escape('\x20\x21\x78\x79')", "\\ \\!xy"); | 74 shouldBeEqualToString("CSS.escape('\x20\x21\x78\x79')", "\\ \\!xy"); |
70 | 75 |
71 // astral symbol (U+1D306 TETRAGRAM FOR CENTRE) | 76 // astral symbol (U+1D306 TETRAGRAM FOR CENTRE) |
72 shouldBeEqualToString("CSS.escape('\uD834\uDF06')", "\uD834\uDF06"); | 77 shouldBeEqualToString("CSS.escape('\uD834\uDF06')", "\uD834\uDF06"); |
73 // lone surrogates | 78 // lone surrogates |
74 shouldBeEqualToString("CSS.escape('\uDF06')", '\uDF06'); | 79 shouldBeEqualToString("CSS.escape('\uDF06')", '\uDF06'); |
75 shouldBeEqualToString("CSS.escape('\uD834')", '\uD834'); | 80 shouldBeEqualToString("CSS.escape('\uD834')", '\uD834'); |
76 </script> | 81 </script> |
77 </body> | 82 </body> |
78 </html> | 83 </html> |
OLD | NEW |