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>This tests selection in readonly texts using shift+Up/Down. When no further u
p/down movement is possible, the selection either moves to the start (for up) or
end (for down) of the line.</p> |
| 9 <div id="console"></div> |
| 10 <script> |
| 11 if (window.testRunner) { |
| 12 testRunner.overridePreference("WebKitEnableCaretBrowsing", false); |
| 13 testRunner.dumpAsText(); |
| 14 } |
| 15 |
| 16 var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1; |
| 17 |
| 18 var target = document.getElementById('target'); |
| 19 var selection = window.getSelection(); |
| 20 var range = document.createRange(); |
| 21 range.setStart(target.firstChild.firstChild, 3); |
| 22 selection.addRange(range); |
| 23 target.focus(); |
| 24 var paragraph1 = target.firstChild.firstChild; |
| 25 var paragraph2 = target.childNodes[1].firstChild; |
| 26 |
| 27 // check up/down arrows + Shift |
| 28 if (window.eventSender) { |
| 29 eventSender.keyDown("upArrow", ["shiftKey"]); |
| 30 shouldBeEqualToString("selection.type", "Range"); |
| 31 shouldBe("selection.anchorNode", "paragraph1"); |
| 32 shouldBe("selection.anchorOffset", "3"); |
| 33 shouldBe("selection.focusNode", "paragraph1"); |
| 34 shouldBe("selection.focusOffset", "0"); |
| 35 eventSender.keyDown("downArrow", ["shiftKey"]); |
| 36 if (onMacPlatform) |
| 37 eventSender.keyDown("downArrow", ["shiftKey"]); |
| 38 shouldBeEqualToString("selection.type", "Range"); |
| 39 shouldBe("selection.anchorNode", "paragraph1"); |
| 40 shouldBe("selection.anchorOffset", "3"); |
| 41 shouldBe("selection.focusNode", "paragraph2"); |
| 42 shouldBe("selection.focusOffset", "3"); |
| 43 } |
| 44 </script> |
| 45 <body> |
| 46 </html> |
OLD | NEW |