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

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, 5 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 id="description"></p>
9 <div id="console"></div>
10 <script>
11 description("This tests selection in readonly texts using shift+Up/Down. With th is key combination you can select up or down the line. When no further up/down m ovement is possible, the selection either moves to the start (for up) or end (fo r down) of the line.")
12 if (window.testRunner) {
13 testRunner.overridePreference("WebKitEnableCaretBrowsing", false);
14 testRunner.dumpAsText();
15 }
16
17 var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
18
19 var target = document.getElementById('target');
20 var selection = window.getSelection();
21 var range = document.createRange();
22 range.setStart(target.firstChild.firstChild, 3);
23 selection.addRange(range);
24 target.focus();
25 var paragraph1 = target.firstChild.firstChild;
26 var paragraph2 = target.childNodes[1].firstChild;
27
28 // check up/down arrows + Shift
29 if (window.eventSender) {
30 eventSender.keyDown("upArrow", ["shiftKey"]);
31 shouldBeEqualToString("selection.type", "Range");
32 shouldBe("selection.anchorNode", "paragraph1");
33 shouldBe("selection.anchorOffset", "3");
34 shouldBe("selection.focusNode", "paragraph1");
35 shouldBe("selection.focusOffset", "0");
36 eventSender.keyDown("downArrow", ["shiftKey"]);
37 if (onMacPlatform)
38 eventSender.keyDown("downArrow", ["shiftKey"]);
39 shouldBeEqualToString("selection.type", "Range");
40 shouldBe("selection.anchorNode", "paragraph1");
41 shouldBe("selection.anchorOffset", "3");
42 shouldBe("selection.focusNode", "paragraph2");
43 shouldBe("selection.focusOffset", "3");
44 }
45 </script>
46 <body>
47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698