OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 </head> |
| 5 <body> |
| 6 <script src="../js/resources/js-test-pre.js"></script> |
| 7 <script> |
| 8 description("This tests that 'Selection' methods throw exceptions with r
easonable messages."); |
| 9 |
| 10 shouldThrow('getSelection().collapse(document.documentElement, -1)', '"I
ndexSizeError: Failed to execute \'collapse\' on \'Selection\': -1 is not a vali
d offset."'); |
| 11 |
| 12 getSelection().empty(); |
| 13 shouldThrow('getSelection().collapseToStart()', '"InvalidStateError: Fai
led to execute \'collapseToStart\' on \'Selection\': there is no selection."'); |
| 14 shouldThrow('getSelection().collapseToEnd()', '"InvalidStateError: Faile
d to execute \'collapseToEnd\' on \'Selection\': there is no selection."'); |
| 15 |
| 16 shouldThrow('getSelection().setBaseAndExtent(document.documentElement, -
1, document.documentElement, 0)', '"IndexSizeError: Failed to execute \'setBaseA
ndExtent\' on \'Selection\': -1 is not a valid base offset."'); |
| 17 shouldThrow('getSelection().setBaseAndExtent(document.documentElement, 0
, document.documentElement, -1)', '"IndexSizeError: Failed to execute \'setBaseA
ndExtent\' on \'Selection\': -1 is not a valid extent offset."'); |
| 18 |
| 19 shouldThrow('getSelection().setPosition(document.documentElement, -1)',
'"IndexSizeError: Failed to execute \'setPosition\' on \'Selection\': -1 is not
a valid offset."'); |
| 20 |
| 21 shouldThrow('getSelection().getRangeAt(-1)', '"IndexSizeError: Failed to
execute \'getRangeAt\' on \'Selection\': -1 is not a valid index."'); |
| 22 |
| 23 shouldThrow('getSelection().extend(0, -1)', '"TypeMismatchError: Failed
to execute \'extend\' on \'Selection\': The node provided is invalid."'); |
| 24 shouldThrow('getSelection().extend(document.documentElement, -1)', '"Ind
exSizeError: Failed to execute \'extend\' on \'Selection\': -1 is not a valid of
fset."'); |
| 25 shouldThrow('getSelection().extend(document.documentElement, 1000)', '"I
ndexSizeError: Failed to execute \'extend\' on \'Selection\': 1000 is larger tha
n the given node\'s length."'); |
| 26 </script> |
| 27 <script src="../js/resources/js-test-post.js"></script> |
| 28 </body> |
| 29 </html> |
OLD | NEW |