OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <link rel="help" href="http://www.w3.org/TR/2012/WD-dom-20121206/#interface-char
acterdata" /> | 4 <link rel="help" href="http://www.w3.org/TR/2012/WD-dom-20121206/#interface-char
acterdata"> |
5 <script src="../js/resources/js-test-pre.js"></script> | 5 <script src="../js/resources/js-test-pre.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 description("Tests that the CharacterData API arguments are correctly validated.
"); | 9 description("Tests that the CharacterData API arguments are correctly validated.
"); |
10 | 10 |
11 var text = document.createTextNode("abcd"); | 11 var text = document.createTextNode("abcd"); |
12 shouldBeEqualToString("text.data", "abcd"); | 12 shouldBeEqualToString("text.data", "abcd"); |
13 shouldBe("text.__proto__.__proto__", "CharacterData.prototype"); | 13 shouldBe("text.__proto__.__proto__", "CharacterData.prototype"); |
14 | 14 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 shouldThrow("text.replaceData(-1, 3, 'test')", "'IndexSizeError: Index or size w
as negative, or greater than the allowed value.'"); // Wraps to 4294967295 which
is greater than the data length | 63 shouldThrow("text.replaceData(-1, 3, 'test')", "'IndexSizeError: Index or size w
as negative, or greater than the allowed value.'"); // Wraps to 4294967295 which
is greater than the data length |
64 shouldBeEqualToString("text.data", "abcdefg"); | 64 shouldBeEqualToString("text.data", "abcdefg"); |
65 shouldNotThrow("text.replaceData(-4294967294, 0, 'test')"); // Wraps to 2, which
is a valid offset. | 65 shouldNotThrow("text.replaceData(-4294967294, 0, 'test')"); // Wraps to 2, which
is a valid offset. |
66 shouldBeEqualToString("text.data", "abtestcdefg"); | 66 shouldBeEqualToString("text.data", "abtestcdefg"); |
67 shouldNotThrow("text.replaceData(1, 999, 'aaa')"); // Length argument is too lar
ge, should be adjusted. | 67 shouldNotThrow("text.replaceData(1, 999, 'aaa')"); // Length argument is too lar
ge, should be adjusted. |
68 shouldBeEqualToString("text.data", "aaaa"); | 68 shouldBeEqualToString("text.data", "aaaa"); |
69 | 69 |
70 // substringData() | 70 // substringData() |
71 text.data = "abcdefg"; | 71 text.data = "abcdefg"; |
72 shouldBeEqualToString("text.substringData(4, 3)", "efg"); | 72 shouldBeEqualToString("text.substringData(4, 3)", "efg"); |
| 73 shouldThrow("text.substringData()", "'TypeError: Not enough arguments'"); |
| 74 shouldThrow("text.substringData(0)", "'TypeError: Not enough arguments'"); |
73 shouldBeEqualToString("text.substringData(4, 999)", "efg"); // Length argument i
s too large, should be adjusted. | 75 shouldBeEqualToString("text.substringData(4, 999)", "efg"); // Length argument i
s too large, should be adjusted. |
| 76 shouldBeEqualToString("text.substringData(4, -1)", "efg"); // Length argument is
too large (after wrapping), should be adjusted. |
74 shouldThrow("text.substringData(-1, 2)", "'IndexSizeError: Index or size was neg
ative, or greater than the allowed value.'"); // Wraps to 4294967295 which is gr
eater than the data length | 77 shouldThrow("text.substringData(-1, 2)", "'IndexSizeError: Index or size was neg
ative, or greater than the allowed value.'"); // Wraps to 4294967295 which is gr
eater than the data length |
75 shouldBeEqualToString("text.substringData(-4294967294, 3)", "cde"); // Wraps to
2, which is a valid offset. | 78 shouldBeEqualToString("text.substringData(-4294967294, 3)", "cde"); // Wraps to
2, which is a valid offset. |
76 | 79 |
77 </script> | 80 </script> |
78 <script src="../js/resources/js-test-post.js"></script> | 81 <script src="../js/resources/js-test-post.js"></script> |
79 </body> | 82 </body> |
80 </html> | 83 </html> |
OLD | NEW |