test_bug633762.html (1812B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=633762 5 --> 6 <head> 7 <title>Test for Bug 633762</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <script type="text/javascript" src="/tests/gfx/layers/apz/test/mochitest/apz_test_utils.js"></script> 11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 12 13 </head> 14 <body> 15 <p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=633762">Mozilla Bug 633762</a> 16 17 <iframe id="i" src="bug633762_iframe.html#a"></iframe> 18 19 <pre id="test"> 20 <script> 21 22 var doc; 23 24 async function runTests() { 25 var i = document.getElementById("i"); 26 doc = i.contentDocument; 27 var win = i.contentWindow; 28 // set display none on b 29 doc.getElementById("b").style.display = "none"; 30 // flush layout 31 doc.documentElement.offsetLeft; 32 // focus on the iframe 33 win.focus(); 34 35 // clear out any potential scroll events so we can listen for the one we want without false positives 36 await waitToClearOutAnyPotentialScrolls(window); 37 38 step2(); 39 } 40 41 function step2() { 42 var i = document.getElementById("i"); 43 doc = i.contentDocument; 44 var win = i.contentWindow; 45 // record scrolltop 46 scrollTopBefore = doc.body.scrollTop; 47 // send up arrow key event 48 sendKey("UP"); 49 50 win.addEventListener("scroll", finish, {once: true, capture: true}); 51 } 52 53 function finish() { 54 // assert that scroll top is now less than before 55 ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up"); 56 SimpleTest.finish(); 57 } 58 59 var smoothScrollPref = "general.smoothScroll"; 60 SimpleTest.waitForExplicitFinish(); 61 SimpleTest.waitForFocus(function() { 62 SpecialPowers.pushPrefEnv({"set":[[smoothScrollPref, false]]}, runTests); 63 }); 64 </script> 65 </pre> 66 67 </body> 68 </html>