| Index: LayoutTests/fast/text/selection-exceptions.html
|
| diff --git a/LayoutTests/fast/text/selection-exceptions.html b/LayoutTests/fast/text/selection-exceptions.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6a51c555225e7db19df1402d88d1b1c868f4aeeb
|
| --- /dev/null
|
| +++ b/LayoutTests/fast/text/selection-exceptions.html
|
| @@ -0,0 +1,29 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| +</head>
|
| +<body>
|
| + <script src="../js/resources/js-test-pre.js"></script>
|
| + <script>
|
| + description("This tests that 'Selection' methods throw exceptions with reasonable messages.");
|
| +
|
| + shouldThrow('getSelection().collapse(document.documentElement, -1)', '"IndexSizeError: Failed to execute \'collapse\' on \'Selection\': -1 is not a valid offset."');
|
| +
|
| + getSelection().empty();
|
| + shouldThrow('getSelection().collapseToStart()', '"InvalidStateError: Failed to execute \'collapseToStart\' on \'Selection\': there is no selection."');
|
| + shouldThrow('getSelection().collapseToEnd()', '"InvalidStateError: Failed to execute \'collapseToEnd\' on \'Selection\': there is no selection."');
|
| +
|
| + shouldThrow('getSelection().setBaseAndExtent(document.documentElement, -1, document.documentElement, 0)', '"IndexSizeError: Failed to execute \'setBaseAndExtent\' on \'Selection\': -1 is not a valid base offset."');
|
| + shouldThrow('getSelection().setBaseAndExtent(document.documentElement, 0, document.documentElement, -1)', '"IndexSizeError: Failed to execute \'setBaseAndExtent\' on \'Selection\': -1 is not a valid extent offset."');
|
| +
|
| + shouldThrow('getSelection().setPosition(document.documentElement, -1)', '"IndexSizeError: Failed to execute \'setPosition\' on \'Selection\': -1 is not a valid offset."');
|
| +
|
| + shouldThrow('getSelection().getRangeAt(-1)', '"IndexSizeError: Failed to execute \'getRangeAt\' on \'Selection\': -1 is not a valid index."');
|
| +
|
| + shouldThrow('getSelection().extend(0, -1)', '"TypeMismatchError: Failed to execute \'extend\' on \'Selection\': The node provided is invalid."');
|
| + shouldThrow('getSelection().extend(document.documentElement, -1)', '"IndexSizeError: Failed to execute \'extend\' on \'Selection\': -1 is not a valid offset."');
|
| + shouldThrow('getSelection().extend(document.documentElement, 1000)', '"IndexSizeError: Failed to execute \'extend\' on \'Selection\': 1000 is larger than the given node\'s length."');
|
| + </script>
|
| + <script src="../js/resources/js-test-post.js"></script>
|
| +</body>
|
| +</html>
|
|
|