OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <script> |
| 8 description("Test deleteData() + replaceData() overflow handling."); |
| 9 |
| 10 var textNode; |
| 11 var range; |
| 12 |
| 13 shouldBeNonNull("textNode = new Text('chopped off and then some'); textNode"); |
| 14 document.body.appendChild(textNode); |
| 15 document.getSelection().extend(textNode, textNode.length); |
| 16 range = document.getSelection().getRangeAt(0); |
| 17 |
| 18 shouldBeEqualToString("textNode.deleteData(11, 0xfffffff7); textNode.data", "cho
pped off"); |
| 19 shouldBe("range.endOffset", "11"); |
| 20 document.body.removeChild(textNode); |
| 21 |
| 22 shouldBeNonNull("textNode = new Text('hello world'); textNode"); |
| 23 document.body.appendChild(textNode); |
| 24 document.getSelection().extend(textNode, textNode.length); |
| 25 range = document.getSelection().getRangeAt(0); |
| 26 |
| 27 shouldBeEqualToString("textNode.replaceData(6, 0xfffffffe, 'bob'); textNode.data
", "hello bob"); |
| 28 shouldBe("range.endOffset", "6"); |
| 29 document.body.removeChild(textNode); |
| 30 |
| 31 shouldBeNonNull("textNode = new Text('hello world'); textNode"); |
| 32 shouldBeEqualToString("textNode.replaceData(6, -1, 'bob'); textNode.data", "hell
o bob"); |
| 33 shouldBeNonNull("textNode = new Text('hello world'); textNode"); |
| 34 shouldBeEqualToString("textNode.replaceData(6, -2, 'bob'); textNode.data", "hell
o bob"); |
| 35 </script> |
| 36 </body> |
| 37 </html> |
OLD | NEW |