| <p>This test selects some characters, then simulates a press of the Enter key (marked Return on Macintosh keyboards).</p> |
| <p><input id="input" value="12345678"></input></p> |
| <p>Content of input after pressing return is "<span id="result"></span>". It should be "12345678".</p> |
| <script> |
| if (window.testRunner) |
| testRunner.dumpAsText(); |
| var input = document.getElementById("input"); |
| input.setSelectionRange(2, 6); |
| var event = document.createEvent("KeyboardEvents"); |
| event.initKeyboardEvent("keypress", true, true, document.defaultView, "Enter", 0, false, false, false, false, false); |
| input.dispatchEvent(event); |
| if (window.eventSender) |
| eventSender.keyDown('\n', []); |
| document.getElementById("result").innerText = input.value; |
| </script> |