test_bug596506.html (1287B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=596506 5 --> 6 <head> 7 <title>Test for Bug 596506</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 <script src="/tests/SimpleTest/EventUtils.js"></script> 11 </head> 12 <body> 13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=596506">Mozilla Bug 596506</a> 14 <p id="display"></p> 15 <div id="content" style="display: none"> 16 17 </div> 18 <pre id="test"> 19 <script type="application/javascript"> 20 21 /** Test for Bug 596506 */ 22 23 SimpleTest.waitForExplicitFinish(); 24 SimpleTest.waitForFocus(runTest); 25 26 const kIsMac = navigator.platform.includes("Mac"); 27 28 29 function runTest() { 30 var edit = document.getElementById("edit"); 31 edit.focus(); 32 33 sendString("First"); 34 synthesizeKey("KEY_Enter"); 35 sendString("Second"); 36 synthesizeKey("KEY_ArrowUp"); 37 synthesizeKey("KEY_ArrowUp"); 38 if (kIsMac) { 39 synthesizeKey("KEY_ArrowRight", { accelKey: true }); 40 } else { 41 synthesizeKey("KEY_End"); 42 } 43 sendString("ly"); 44 is(edit.value, "Firstly\nSecond", 45 "Pressing end should position the cursor before the terminating newline"); 46 SimpleTest.finish(); 47 } 48 49 </script> 50 </pre> 51 52 <textarea id="edit"></textarea> 53 54 </body> 55 </html>