| Index: LayoutTests/editing/selection/select-till-begining-or-end-of-line-in-readonly-texts-using-keys-with-caret-mode-off.html
|
| diff --git a/LayoutTests/editing/selection/select-till-begining-or-end-of-line-in-readonly-texts-using-keys-with-caret-mode-off.html b/LayoutTests/editing/selection/select-till-begining-or-end-of-line-in-readonly-texts-using-keys-with-caret-mode-off.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b781000b78dbe011d44bba439400f663524bf877
|
| --- /dev/null
|
| +++ b/LayoutTests/editing/selection/select-till-begining-or-end-of-line-in-readonly-texts-using-keys-with-caret-mode-off.html
|
| @@ -0,0 +1,56 @@
|
| +<html>
|
| +<script>
|
| +
|
| +function logResult(str) {
|
| + if (str != 'SUCCESS')
|
| + str += ' baseOffset: ' + sel.baseOffset + ' extentOffset: ' + sel.extentOffset;
|
| + document.getElementById('result').innerHTML = str;
|
| +}
|
| +
|
| +function runTest() {
|
| + if (!window.testRunner) {
|
| + log('This test must be run by DumpRenderTree!')
|
| + return;
|
| + }
|
| + testRunner.overridePreference("WebKitEnableCaretBrowsing", false);
|
| + testRunner.dumpAsText();
|
| +
|
| + var onMacPlatform = navigator.userAgent.search(/\bMac OS X\b/) != -1;
|
| +
|
| + var target = document.getElementById('target');
|
| + target.focus();
|
| +
|
| + window.getSelection().setPosition(target.childNodes.item(0), 3);
|
| + // Now move to the end, selecting
|
| + if (onMacPlatform)
|
| + eventSender.keyDown("rightArrow", ["metaKey", "shiftKey"]);
|
| + else
|
| + eventSender.keyDown("end",["shiftKey"]);
|
| +
|
| + if (!((getSelection().baseOffset == 3) && (getSelection().extentOffset == 9))) {
|
| + logResult("Selection should contain the line starting from baseOffset till the end of the line with forward directionality.");
|
| + return;
|
| + }
|
| +
|
| + window.getSelection().setPosition(target.childNodes.item(0), 3);
|
| +
|
| + // Now move to the beginning, selecting
|
| + if (onMacPlatform)
|
| + eventSender.keyDown("leftArrow", ["metaKey", "shiftKey"]);
|
| + else
|
| + eventSender.keyDown("home",["shiftKey"]);
|
| +
|
| + if (!((getSelection().baseOffset == 3) && (getSelection().extentOffset == 0))) {
|
| + logResult("Selection should contain the line starting from baseOffset till the beginning of the line with backward directionality.");
|
| + return;
|
| + }
|
| +
|
| + logResult('SUCCESS');
|
| +}
|
| +</script>
|
| +<body onload="runTest();">
|
| + <div contenteditable="false" id="target">Some text</div>
|
| + <p>This tests selection using Command+Left/Right arrows in Mac and Shift+Home/End in other platform for readonly texts. If this test is successful, the text "SUCCESS" will be shown below.</p>
|
| + <div id="result">FAILURE</div>
|
| +</body>
|
| +</html>
|
|
|