diff options
Diffstat (limited to 'LayoutTests/fast/dom/Selection')
4 files changed, 69 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/Selection/getRangeAt-expected.txt b/LayoutTests/fast/dom/Selection/getRangeAt-expected.txt new file mode 100644 index 0000000..909034f --- /dev/null +++ b/LayoutTests/fast/dom/Selection/getRangeAt-expected.txt @@ -0,0 +1,10 @@ +Test to make sure that getRangeAt does not modify the range when returning it. + +On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". + + +PASS range is correctly (text, 0) +PASS successfullyParsed is true + +TEST COMPLETE + diff --git a/LayoutTests/fast/dom/Selection/getRangeAt.html b/LayoutTests/fast/dom/Selection/getRangeAt.html new file mode 100644 index 0000000..a4037a9 --- /dev/null +++ b/LayoutTests/fast/dom/Selection/getRangeAt.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/getRangeAt.js"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/Selection/script-tests/TEMPLATE.html b/LayoutTests/fast/dom/Selection/script-tests/TEMPLATE.html new file mode 100644 index 0000000..1951c43 --- /dev/null +++ b/LayoutTests/fast/dom/Selection/script-tests/TEMPLATE.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="YOUR_JS_FILE_HERE"></script> +<script src="../../js/resources/js-test-post.js"></script> +</body> +</html> diff --git a/LayoutTests/fast/dom/Selection/script-tests/getRangeAt.js b/LayoutTests/fast/dom/Selection/script-tests/getRangeAt.js new file mode 100644 index 0000000..e024a03 --- /dev/null +++ b/LayoutTests/fast/dom/Selection/script-tests/getRangeAt.js @@ -0,0 +1,33 @@ +description("Test to make sure that getRangeAt does not modify the range when returning it.") + +var div = document.createElement('div'); +document.body.appendChild(div); +var textNode = document.createTextNode("asd"); +div.appendChild(textNode); + +var sel = window.getSelection(); +sel.collapse(textNode, 0); +var range = sel.getRangeAt(0); + +var result = range.comparePoint(textNode, 0); +if (result == 0) { + testPassed("range is correctly (text, 0)"); +} else { + testFailed("range did not match (text, 0)"); + debug("window.getSelection():"); + debug("anchorNode: " + sel.anchorNode); + debug("anchorOffset: " + sel.anchorOffset); + debug("focusNode: " + sel.focusNode); + debug("focusOffset: " + sel.focusOffset); + + debug("window.getSelection().getRangeAt(0):"); + debug("startContainer: " + range.startContainer); + debug("startOffset: " + range.startOffset); + debug("endContainer: " + range.endContainer); + debug("endOffset: " + range.endOffset); +} + +// Clean up after ourselves +document.body.removeChild(div); + +var successfullyParsed = true; |