helper_bug1674935.html (2490B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Tests that keyboard arrow keys scroll a very specific page</title> 6 <script src="/tests/SimpleTest/EventUtils.js"></script> 7 <script type="application/javascript" src="apz_test_utils.js"></script> 8 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 9 <script src="/tests/SimpleTest/paint_listener.js"></script> 10 <script> 11 function start() { 12 document.documentElement.addEventListener("keyup", function() { console.log("keyup"); }); 13 document.documentElement.addEventListener("keydown", function() { console.log("keydown"); }); 14 document.documentElement.addEventListener("keypress", function() { console.log("keypress"); }); 15 } 16 </script> 17 <style> 18 .z1asCe { 19 display: inline-block; 20 width: 24px 21 } 22 .kno-ecr-pt { 23 position: relative; 24 } 25 .rsir2d { 26 opacity: 0.54 27 } 28 .bErdLd { 29 position: fixed; 30 right: 0; 31 bottom: 0; 32 top: 0; 33 left: 0; 34 } 35 </style> 36 </head> 37 <body onload="start();"> 38 <div style="height: 4000px;"> 39 <div class="rsir2d"> 40 <span class=" z1asCe "> 41 <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"> 42 <path d="M18 16.08c-.76 0-1.44.3-1.96.77L8.91 12.7c.05-.23.09-.46.09-.7s-.04-.47-.09-.7l7.05-4.11c.54.5 1.25.81 2.04.81 1.66 0 3-1.34 3-3s-1.34-3-3-3-3 1.34-3 3c0 .24.04.47.09.7L8.04 9.81C7.5 9.31 6.79 9 6 9c-1.66 0-3 1.34-3 3s1.34 3 3 3c.79 0 1.5-.31 2.04-.81l7.12 4.16c-.05.21-.08.43-.08.65 0 1.61 1.31 2.92 2.92 2.92 1.61 0 2.92-1.31 2.92-2.92s-1.31-2.92-2.92-2.92z"></path> 43 </svg> 44 </span> 45 <div class="bErdLd"> 46 </div> 47 </div> 48 <h2 class="kno-ecr-pt"><span>Firefox</span></h2> 49 </div> 50 51 <script type="application/javascript"> 52 53 function waitForScrollEvent(target) { 54 return new Promise(resolve => { 55 target.addEventListener("scroll", resolve, { once: true }); 56 }); 57 } 58 59 async function test() { 60 is(window.scrollX, 0, "shouldn't have scrolled (1)"); 61 is(window.scrollY, 0, "shouldn't have scrolled (2)"); 62 63 let waitForScroll = waitForScrollEvent(window); 64 65 window.synthesizeKey("KEY_ArrowDown"); 66 67 await waitForScroll; 68 69 is(window.scrollX, 0, "shouldn't have scrolled (3)"); 70 isnot(window.scrollY, 0, "should have scrolled (4)"); 71 } 72 73 waitUntilApzStable().then(test).then(subtestDone, subtestFailed); 74 </script> 75 </body> 76 </html>