diff options
Diffstat (limited to 'LayoutTests/fast/dom')
3 files changed, 43 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt new file mode 100644 index 0000000..1a77f93 --- /dev/null +++ b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection-expected.txt @@ -0,0 +1,13 @@ +Test that collapseToStart() and collapseToEnd() throw INVALID_STATE_ERR if no selection is made. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS sel.collapseToStart() threw exception Error: INVALID_STATE_ERR: DOM Exception 11. +PASS sel.collapseToEnd() threw exception Error: INVALID_STATE_ERR: DOM Exception 11. +PASS sel.collapseToStart() is undefined +PASS sel.collapseToEnd() is undefined +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html new file mode 100644 index 0000000..5463fff --- /dev/null +++ b/LayoutTests/fast/dom/Selection/collapseToX-empty-selection.html @@ -0,0 +1,13 @@ +<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> +<html> +<head> +<link rel="stylesheet" href="../../js/resources/js-test-style.css"> +<script src="../../js/resources/js-test-pre.js"></script> +</head> +<body> +<p id="description"></p> +<div id="console"></div> +<script src="script-tests/collapseToX-empty-selection.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js b/LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js new file mode 100644 index 0000000..c1fd73c --- /dev/null +++ b/LayoutTests/fast/dom/Selection/script-tests/collapseToX-empty-selection.js @@ -0,0 +1,17 @@ +description("Test that collapseToStart() and collapseToEnd() throw INVALID_STATE_ERR if no selection is made."); + +var sel = window.getSelection(); +var textNode = document.createTextNode("abcdef"); +document.body.appendChild(textNode); + +shouldThrow("sel.collapseToStart()", "'Error: INVALID_STATE_ERR: DOM Exception 11'"); +shouldThrow("sel.collapseToEnd()", "'Error: INVALID_STATE_ERR: DOM Exception 11'"); + +sel.selectAllChildren(textNode); + +shouldBe("sel.collapseToStart()", "undefined"); +shouldBe("sel.collapseToEnd()", "undefined"); + +document.body.removeChild(textNode); + +var successfullyParsed = true; |