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

Side by Side Diff: LayoutTests/editing/selection/select-down-or-up-the-lines-in-readonly-texts-using-keys-with-caret-mode-off.html

Issue 268993002: For non-editable content, selection editor commands are disabled Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
OLDNEW
(Empty)
1 <html>
2 <head>
3 <script src="../../resources/js-test.js"></script>
4 </head>
5 <body>
6 <div id="target" contenteditable="false"><p>This is the first paragraph.</p><p>T his is the second paragraph.</p>
7 </div>
8 <p>This tests selection in readonly texts using shift+Up/Down. When no further u p/down movement is possible, the selection either moves to the start (for up) or end (for down) of the line.</p>
9 <div id="console"></div>
10 <script>
11 if (window.testRunner) {
12 testRunner.overridePreference("WebKitEnableCaretBrowsing", false);
13 testRunner.dumpAsText();
14 }
15
16 var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
17
18 var target = document.getElementById('target');
19 var selection = window.getSelection();
20 var range = document.createRange();
21 range.setStart(target.firstChild.firstChild, 3);
22 selection.addRange(range);
23 target.focus();
24 var paragraph1 = target.firstChild.firstChild;
25 var paragraph2 = target.childNodes[1].firstChild;
26
27 // check up/down arrows + Shift
28 if (window.eventSender) {
29 eventSender.keyDown("upArrow", ["shiftKey"]);
30 shouldBeEqualToString("selection.type", "Range");
31 shouldBe("selection.anchorNode", "paragraph1");
32 shouldBe("selection.anchorOffset", "3");
33 shouldBe("selection.focusNode", "paragraph1");
34 shouldBe("selection.focusOffset", "0");
35 eventSender.keyDown("downArrow", ["shiftKey"]);
36 if (onMacPlatform)
37 eventSender.keyDown("downArrow", ["shiftKey"]);
38 shouldBeEqualToString("selection.type", "Range");
39 shouldBe("selection.anchorNode", "paragraph1");
40 shouldBe("selection.anchorOffset", "3");
41 shouldBe("selection.focusNode", "paragraph2");
42 shouldBe("selection.focusOffset", "3");
43 }
44 </script>
45 <body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698