| Index: LayoutTests/editing/selection/stay-in-textarea.html
|
| diff --git a/LayoutTests/editing/selection/stay-in-textarea.html b/LayoutTests/editing/selection/stay-in-textarea.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..756bd24bf52e83f2f1419a48f5a9536266a6d166
|
| --- /dev/null
|
| +++ b/LayoutTests/editing/selection/stay-in-textarea.html
|
| @@ -0,0 +1,56 @@
|
| +<!DOCTYPE HTML>
|
| +<html>
|
| +<body>
|
| +<script src="../../fast/js/resources/js-test-pre.js"></script>
|
| +
|
| +<p id="before">Before</p>
|
| +<textarea id="textarea">Text</textarea>
|
| +<p id="after">After</p>
|
| +
|
| +<div id="console"></div>
|
| +<script>
|
| +description("Ensure that extending a selection beyond a textarea does not escape outside its shadow root.");
|
| +
|
| +var before = document.getElementById("before");
|
| +var after = document.getElementById("after");
|
| +var textarea = document.getElementById("textarea");
|
| +
|
| +textarea.setSelectionRange(0, 2);
|
| +var textareaSelection = internals.youngestShadowRoot(textarea).getSelection();
|
| +var initialTextareaFocusNode = textareaSelection.focusNode;
|
| +
|
| +var initialFocusNode = window.getSelection().focusNode;
|
| +var initialFocusOffset = window.getSelection().focusOffset;
|
| +
|
| +shouldBe("textareaSelection.focusOffset", "2");
|
| +
|
| +textareaSelection.modify("extend", "forward", "character");
|
| +shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
|
| +shouldBe("textareaSelection.focusOffset", "3");
|
| +
|
| +textareaSelection.modify("extend", "forward", "character");
|
| +shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
|
| +shouldBe("textareaSelection.focusOffset", "4");
|
| +
|
| +// We're at the end - none of these should modify the selection any more.
|
| +
|
| +textareaSelection.modify("extend", "forward", "character");
|
| +shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
|
| +shouldBe("textareaSelection.focusOffset", "4");
|
| +
|
| +textareaSelection.modify("extend", "forward", "word");
|
| +shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
|
| +shouldBe("textareaSelection.focusOffset", "4");
|
| +
|
| +textareaSelection.modify("extend", "forward", "line");
|
| +shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
|
| +shouldBe("textareaSelection.focusOffset", "4");
|
| +
|
| +shouldBe("window.getSelection().focusNode", "initialFocusNode");
|
| +shouldBe("window.getSelection().focusOffset", "initialFocusOffset");
|
| +
|
| +</script>
|
| +
|
| +<script src="../../fast/js/resources/js-test-post.js"></script>
|
| +</body>
|
| +</html>
|
|
|