OLD | NEW |
(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> |
OLD | NEW |