OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>addRange failures</title> | 4 <title>addRange failures</title> |
5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/js-test.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <script> | 8 <script> |
9 description('Test error handling of Selection.addRange().'); | 9 description('Test error handling of Selection.addRange().'); |
10 | 10 |
11 var selection = window.getSelection(); | 11 var selection = window.getSelection(); |
12 | 12 |
13 function testNull() | 13 function testNull() |
14 { | 14 { |
15 selection.addRange(null); | 15 shouldThrow('selection.addRange(null)'); |
16 } | 16 } |
17 | 17 |
18 function testDetachedRange() | 18 function testDetachedRange() |
19 { | 19 { |
20 var range = new Range(); | 20 var range = new Range(); |
21 range.detach(); | 21 range.detach(); |
22 selection.addRange(range); | 22 selection.addRange(range); |
23 } | 23 } |
24 | 24 |
25 function testNotInDocumentRange() | 25 function testNotInDocumentRange() |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 shouldEvaluateTo('selection.getRangeAt(0).startOffset', 0); | 71 shouldEvaluateTo('selection.getRangeAt(0).startOffset', 0); |
72 shouldBeTrue('selection.getRangeAt(0).endContainer === document.body'); | 72 shouldBeTrue('selection.getRangeAt(0).endContainer === document.body'); |
73 shouldEvaluateTo('selection.getRangeAt(0).endOffset', 0); | 73 shouldEvaluateTo('selection.getRangeAt(0).endOffset', 0); |
74 } | 74 } |
75 | 75 |
76 var testFunctions = [testNull, testDetachedRange, testNotInDocumentRange, testOt
herDocument, testOtherDocumentFragments]; | 76 var testFunctions = [testNull, testDetachedRange, testNotInDocumentRange, testOt
herDocument, testOtherDocumentFragments]; |
77 testFunctions.forEach(runSingleTest); | 77 testFunctions.forEach(runSingleTest); |
78 </script> | 78 </script> |
79 </body> | 79 </body> |
80 </html> | 80 </html> |
OLD | NEW |