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..8f840cf84971a7e5ba4af4b72267eef730fcf78a |
--- /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 @@ |
+<html> |
+<head> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<p id="description"></p> |
+<p>To test it manually, click on non-editable content using mouse. Then by pressing shift key along with left/right arrow key you can select character by character. To select word by word hold shift, ctrl key and press left/right arrow key.</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> |
+description("This test selects non-editable content using left/right arrow keys in combination with shift and ctrl modifiers when caretbrowsing is disabled.") |
+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> |