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

Side by Side Diff: LayoutTests/editing/selection/select-by-char-and-word-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 <p id="description"></p>
7 <p>To test it manually, click on non-editable content using mouse. Then by press ing shift key along with left/right arrow key you can select character by charac ter. To select word by word hold shift, ctrl key and press left/right arrow key. </p>
8 <p id="target">Select using shift and left or right arrow key to see character b y character selection. Select using shift and ctrl and left or right arrow key t o see word by word selection.</p>
9 <div id="console"></div>
10 <script>
11 description("This test selects non-editable content using left/right arrow keys in combination with shift and ctrl modifiers when caretbrowsing is disabled.")
12 if (window.testRunner && window.internals) {
13 testRunner.overridePreference("WebKitEnableCaretBrowsing", false);
14 testRunner.dumpAsText();
15 internals.settings.setEditingBehavior('mac');
16
17 var target = document.getElementById("target");
18 target.focus();
19
20 // check left/right arrows + Shift
21 window.getSelection().setPosition(target.childNodes.item(0), 10);
22 eventSender.keyDown("rightArrow", ["shiftKey"]);
23 eventSender.keyDown("rightArrow", ["shiftKey"]);
24 shouldBe("getSelection().baseOffset", "10");
25 shouldBe("getSelection().extentOffset", "12");
26 eventSender.keyDown("leftArrow", ["shiftKey"]);
27 eventSender.keyDown("leftArrow", ["shiftKey"]);
28 eventSender.keyDown("leftArrow", ["shiftKey"]);
29 shouldBe("getSelection().baseOffset", "10");
30 shouldBe("getSelection().extentOffset", "9");
31
32 // check left/right arrows + Ctrl + Shift
33 window.getSelection().setPosition(target.childNodes.item(0), 10);
34 var modifierForWordGranularity = navigator.platform == "MacIntel" ? "altKey" : "ctrlKey";
35 eventSender.keyDown("rightArrow", [modifierForWordGranularity, "shiftKey"]);
36 eventSender.keyDown("rightArrow", [modifierForWordGranularity, "shiftKey"]);
37 shouldBe("getSelection().baseOffset", "10");
38 shouldBe("getSelection().extentOffset", "18");
39 eventSender.keyDown("leftArrow", [modifierForWordGranularity, "shiftKey"]);
40 shouldBe("getSelection().baseOffset", "10");
41 shouldBe("getSelection().extentOffset", "13");
42 }
43
44 </script>
45 </body>
46 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698