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