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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/selection/select-by-char-and-word-in-readonly-texts-using-keys-with-caret-mode-off.html
diff --git a/LayoutTests/editing/selection/select-by-char-and-word-in-readonly-texts-using-keys-with-caret-mode-off.html b/LayoutTests/editing/selection/select-by-char-and-word-in-readonly-texts-using-keys-with-caret-mode-off.html
new file mode 100644
index 0000000000000000000000000000000000000000..413b67b8bb1624dcf2f53e38cbba2b77012c310f
--- /dev/null
+++ b/LayoutTests/editing/selection/select-by-char-and-word-in-readonly-texts-using-keys-with-caret-mode-off.html
@@ -0,0 +1,46 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
Yuta Kitamura 2014/06/04 08:19:38 Use HTML5 doctype instead of this legacy one.
b.rout 2014/06/04 12:53:04 Ok.
+<html>
+<head>
+<script src="../../resources/js-test.js"></script>
+</head>
+<body>
+<p>This test selects readonly texts using left/right arrow keys in combination with shift and ctrl modifiers when caretbrowsing is disabled.</p>
+<p id="target">Select using shift and left or right arrow key to see character by character selection. Select using shift and ctrl and left or right arrow key to see word by word selection.</p>
+<div id="console"></div>
+<script>
+
+if (window.testRunner && window.internals) {
+ testRunner.overridePreference("WebKitEnableCaretBrowsing", false);
+ testRunner.dumpAsText();
+ internals.settings.setEditingBehavior('mac');
+
+ var target = document.getElementById("target");
+ target.focus();
+
+ // check left/right arrows + Shift
+ window.getSelection().setPosition(target.childNodes.item(0), 10);
+ eventSender.keyDown("rightArrow", ["shiftKey"]);
+ eventSender.keyDown("rightArrow", ["shiftKey"]);
+ shouldBe("getSelection().baseOffset", "10");
+ shouldBe("getSelection().extentOffset", "12");
+ eventSender.keyDown("leftArrow", ["shiftKey"]);
+ eventSender.keyDown("leftArrow", ["shiftKey"]);
+ eventSender.keyDown("leftArrow", ["shiftKey"]);
+ shouldBe("getSelection().baseOffset", "10");
+ shouldBe("getSelection().extentOffset", "9");
+
+ // check left/right arrows + Ctrl + Shift
+ window.getSelection().setPosition(target.childNodes.item(0), 10);
+ var modifierForWordGranularity = navigator.platform == "MacIntel" ? "altKey" : "ctrlKey";
+ eventSender.keyDown("rightArrow", [modifierForWordGranularity, "shiftKey"]);
+ eventSender.keyDown("rightArrow", [modifierForWordGranularity, "shiftKey"]);
+ shouldBe("getSelection().baseOffset", "10");
+ shouldBe("getSelection().extentOffset", "18");
+ eventSender.keyDown("leftArrow", [modifierForWordGranularity, "shiftKey"]);
+ shouldBe("getSelection().baseOffset", "10");
+ shouldBe("getSelection().extentOffset", "13");
+}
+
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698