| <html> |
| <head> |
| <script> |
| if (window.layoutTestController) |
| layoutTestController.dumpEditingCallbacks(); |
| </script> |
| |
| <script> |
| function runTest() { |
| if (window.layoutTestController) |
| layoutTestController.dumpAsText(); |
| else { |
| log('This test must be run by DumpRenderTree!') |
| return; |
| } |
| |
| var area = document.getElementById('area'); |
| area.focus(); |
| |
| var sel = window.getSelection(); |
| // Position the caret at the beginning of the string. |
| eventSender.keyDown(String.fromCharCode(0xf702)); |
| |
| // Now move to the end |
| eventSender.keyDown(String.fromCharCode(0xf703), ["metaKey"]); |
| |
| if (sel.baseOffset != 9 || sel.extentOffset != 9) |
| return; |
| |
| // Now move back to the beginning |
| eventSender.keyDown(String.fromCharCode(0xf702), ["metaKey"]); |
| |
| if (sel.baseOffset != 0 || sel.extentOffset != 0) |
| return; |
| |
| // Now move to the end, selecting |
| eventSender.keyDown(String.fromCharCode(0xf703), ["metaKey", "shiftKey"]); |
| |
| if (sel.baseOffset != 0 || sel.extentOffset != 9) |
| return; |
| |
| // Deselect but position the caret at the end |
| eventSender.keyDown(String.fromCharCode(0xf703)); |
| |
| if (sel.baseOffset != 9 || sel.extentOffset != 9) |
| return; |
| |
| // Now move to the beginning, selecting |
| eventSender.keyDown(String.fromCharCode(0xf702), ["metaKey", "shiftKey"]); |
| |
| if (sel.baseOffset != 9 || sel.extentOffset != 0) |
| return; |
| |
| document.getElementById('result').innerHTML = 'SUCCESS' |
| } |
| </script> |
| </head> |
| <body onload="runTest();"> |
| <textarea id="area">Some text</textarea> |
| <div>This tests that moving the caret and selecting using Command+Left/Right arrows work correctly. If this text is successful, the text "SUCCESS" will be shown below.</div> |
| <div id="result">FAILURE</div> |
| </body> |
| </html> |