test_bug562447.html (1542B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=562447 5 --> 6 <head> 7 <title>Test for Bug 562447</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 10 11 </head> 12 <body> 13 <p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=562447">Mozilla Bug 562447</a> 14 15 <input id="WhyDoYouFocusMe" 16 style="position: absolute; left: -50px; top: 10000px;"> 17 18 <pre id="test"> 19 <script> 20 addLoadEvent(function() { 21 // Scroll down a bit 22 window.scrollTo(0, 5000); 23 24 setTimeout(function() { 25 // Make sure that we're scrolled by 5000px 26 is(Math.round(window.pageYOffset), 5000, "Make sure we're scrolled correctly"); 27 28 // Scroll back up, and mess with the input box along the way 29 var input = document.getElementById("WhyDoYouFocusMe"); 30 input.focus(); 31 input.blur(); 32 window.scrollTo(0, 0); 33 34 setTimeout(function() { 35 is(window.pageYOffset, 0, "Make sure we're scrolled back up correctly"); 36 37 // Scroll back up 38 window.scrollTo(0, 5000); 39 40 setTimeout(function() { 41 is(Math.round(window.pageYOffset), 5000, "Sanity check"); 42 43 window.scrollTo(0, 0); 44 input.focus(); 45 input.blur(); 46 47 setTimeout(function() { 48 isnot(Math.round(window.pageYOffset), 0, "This time we shouldn't be scrolled up"); 49 50 SimpleTest.finish(); 51 }, 0); 52 }, 0); 53 }, 0); 54 }, 0); 55 }); 56 57 SimpleTest.waitForExplicitFinish(); 58 </script> 59 </pre> 60 61 </body> 62 </html>