Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: LayoutTests/editing/selection/stay-in-textarea.html

Issue 20572005: Allow selection to skip over contenteditable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Work around minor platform differences in test Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html>
3 <body>
4 <script src="../../fast/js/resources/js-test-pre.js"></script>
5
6 <p id="before">Before</p>
7 <textarea id="textarea">Text</textarea>
8 <p id="after">After</p>
9
10 <div id="console"></div>
11 <script>
12 description("Ensure that extending a selection beyond a textarea does not escape outside its shadow root.");
13
14 var before = document.getElementById("before");
15 var after = document.getElementById("after");
16 var textarea = document.getElementById("textarea");
17
18 textarea.setSelectionRange(0, 2);
19 var textareaSelection = internals.youngestShadowRoot(textarea).getSelection();
20 var initialTextareaFocusNode = textareaSelection.focusNode;
21
22 var initialFocusNode = window.getSelection().focusNode;
23 var initialFocusOffset = window.getSelection().focusOffset;
24
25 shouldBe("textareaSelection.focusOffset", "2");
26
27 textareaSelection.modify("extend", "forward", "character");
28 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
29 shouldBe("textareaSelection.focusOffset", "3");
30
31 textareaSelection.modify("extend", "forward", "character");
32 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
33 shouldBe("textareaSelection.focusOffset", "4");
34
35 // We're at the end - none of these should modify the selection any more.
36
37 textareaSelection.modify("extend", "forward", "character");
38 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
39 shouldBe("textareaSelection.focusOffset", "4");
40
41 textareaSelection.modify("extend", "forward", "word");
42 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
43 shouldBe("textareaSelection.focusOffset", "4");
44
45 textareaSelection.modify("extend", "forward", "line");
46 shouldBe("textareaSelection.focusNode", "initialTextareaFocusNode");
47 shouldBe("textareaSelection.focusOffset", "4");
48
49 shouldBe("window.getSelection().focusNode", "initialFocusNode");
50 shouldBe("window.getSelection().focusOffset", "initialFocusOffset");
51
52 </script>
53
54 <script src="../../fast/js/resources/js-test-post.js"></script>
55 </body>
56 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698