bug1896051.html (1022B)
1 <!doctype html> 2 <html class="reftest-wait"> 3 <script src="/tests/SimpleTest/EventUtils.js"></script> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <style> 6 textarea { 7 font: 13px / 1 monospace; 8 border: 1px solid; 9 padding: 0; 10 overflow: hidden; 11 resize: none; 12 } 13 </style> 14 <textarea rows=5> 15 a 16 b 17 c 18 d 19 </textarea> 20 <script> 21 SimpleTest.waitForFocus(function() { 22 let textarea = document.querySelector("textarea"); 23 textarea.focus(); 24 if (navigator.platform.startsWith("Mac")) { 25 // On mac there is no page down key that moves the selection, afaict. 26 // (Fn+Arrow moves the scroll position but not selection). 27 // Do the next thing which would be something like Cmd+Down to move to the 28 // end. That tests a different code-path altogether, but for this test it 29 // doesn't matter. 30 synthesizeKey("KEY_ArrowDown", { metaKey: true }); 31 } else { 32 synthesizeKey("KEY_PageDown"); 33 } 34 setTimeout(() => { 35 document.documentElement.removeAttribute("class") 36 }, 0); 37 }); 38 </script>