layout/generic/test/test_bug633762.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/test/test_bug633762.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=633762
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 633762</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +
    1.15 +</head>
    1.16 +<body>
    1.17 +<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=633762">Mozilla Bug 633762</a>
    1.18 +
    1.19 +<iframe id="i" src="bug633762_iframe.html#a"></iframe>
    1.20 +
    1.21 +<pre id="test">
    1.22 +<script>
    1.23 +
    1.24 +var doc;
    1.25 +
    1.26 +function runTests() {
    1.27 +  var i = document.getElementById("i");
    1.28 +  doc = i.contentDocument;
    1.29 +  var win = i.contentWindow;
    1.30 +  // set display none on b
    1.31 +  doc.getElementById("b").style.display = "none";
    1.32 +  // flush layout
    1.33 +  doc.documentElement.offsetLeft;
    1.34 +  // click in middle of iframe document to give it focus
    1.35 +  synthesizeMouseAtCenter(i, {}, win);
    1.36 +  win.focus();
    1.37 +  // record scrolltop
    1.38 +  scrollTopBefore = doc.body.scrollTop;
    1.39 +  // send up arrow key event
    1.40 +  sendKey("UP");
    1.41 +
    1.42 +  setTimeout("finish();", 20);
    1.43 +}
    1.44 +
    1.45 +function finish() {
    1.46 +  // assert that scroll top is now less than before
    1.47 +  ok(scrollTopBefore > doc.body.scrollTop, "pressing up arrow should scroll up");
    1.48 +  SpecialPowers.clearUserPref(smoothScrollPref);
    1.49 +  SimpleTest.finish();
    1.50 +}
    1.51 +
    1.52 +var smoothScrollPref = "general.smoothScroll";
    1.53 +SpecialPowers.setBoolPref(smoothScrollPref, false);
    1.54 +SimpleTest.waitForExplicitFinish();
    1.55 +SimpleTest.waitForFocus(runTests);
    1.56 +</script>
    1.57 +</pre>
    1.58 +
    1.59 +</body>
    1.60 +</html>

mercurial