layout/generic/test/test_bug633762.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML>
michael@0 2 <html>
michael@0 3 <!--
michael@0 4 https://bugzilla.mozilla.org/show_bug.cgi?id=633762
michael@0 5 -->
michael@0 6 <head>
michael@0 7 <title>Test for Bug 633762</title>
michael@0 8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 9 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 11
michael@0 12 </head>
michael@0 13 <body>
michael@0 14 <p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=633762">Mozilla Bug 633762</a>
michael@0 15
michael@0 16 <iframe id="i" src="bug633762_iframe.html#a"></iframe>
michael@0 17
michael@0 18 <pre id="test">
michael@0 19 <script>
michael@0 20
michael@0 21 var doc;
michael@0 22
michael@0 23 function runTests() {
michael@0 24 var i = document.getElementById("i");
michael@0 25 doc = i.contentDocument;
michael@0 26 var win = i.contentWindow;
michael@0 27 // set display none on b
michael@0 28 doc.getElementById("b").style.display = "none";
michael@0 29 // flush layout
michael@0 30 doc.documentElement.offsetLeft;
michael@0 31 // click in middle of iframe document to give it focus
michael@0 32 synthesizeMouseAtCenter(i, {}, win);
michael@0 33 win.focus();
michael@0 34 // record scrolltop
michael@0 35 scrollTopBefore = doc.body.scrollTop;
michael@0 36 // send up arrow key event
michael@0 37 sendKey("UP");
michael@0 38
michael@0 39 setTimeout("finish();", 20);
michael@0 40 }
michael@0 41
michael@0 42 function finish() {
michael@0 43 // assert that scroll top is now less than before
michael@0 44 ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up");
michael@0 45 SpecialPowers.clearUserPref(smoothScrollPref);
michael@0 46 SimpleTest.finish();
michael@0 47 }
michael@0 48
michael@0 49 var smoothScrollPref = "general.smoothScroll";
michael@0 50 SpecialPowers.setBoolPref(smoothScrollPref, false);
michael@0 51 SimpleTest.waitForExplicitFinish();
michael@0 52 SimpleTest.waitForFocus(runTests);
michael@0 53 </script>
michael@0 54 </pre>
michael@0 55
michael@0 56 </body>
michael@0 57 </html>

mercurial