layout/forms/test/test_bug564115.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/forms/test/test_bug564115.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,55 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=564115
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 564115</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.13 +
    1.14 +</head>
    1.15 +<body>
    1.16 +<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=564115">Mozilla Bug 564115</a>
    1.17 +
    1.18 +<pre id="test">
    1.19 +<script>
    1.20 +
    1.21 +const TEST_URL = "/tests/layout/forms/test/bug564115_window.html";
    1.22 +
    1.23 +addLoadEvent(function() {
    1.24 +  var win = open(TEST_URL, "", "width=600,height=600");
    1.25 +  SimpleTest.waitForFocus(function() {
    1.26 +    var doc = win.document;
    1.27 +    var input = doc.querySelector("input");
    1.28 +
    1.29 +    // Focus the input box, and wait for the focus to actually happen
    1.30 +    input.focus();
    1.31 +    setTimeout(function() {
    1.32 +      // Scroll down a bit
    1.33 +      win.scrollTo(0, 5000);
    1.34 +
    1.35 +      setTimeout(function() {
    1.36 +        is(win.pageYOffset, 5000, "Page should be scrolled correctly");
    1.37 +
    1.38 +        // Refocus the window
    1.39 +        SimpleTest.waitForFocus(function() {
    1.40 +          SimpleTest.waitForFocus(function() {
    1.41 +            is(win.pageYOffset, 5000,
    1.42 +               "The page's scroll offset should not have been changed");
    1.43 +
    1.44 +            win.close();
    1.45 +            SimpleTest.finish();
    1.46 +          }, win);
    1.47 +        });
    1.48 +      }, 0);
    1.49 +    }, 0);
    1.50 +  }, win);
    1.51 +});
    1.52 +
    1.53 +SimpleTest.waitForExplicitFinish();
    1.54 +</script>
    1.55 +</pre>
    1.56 +
    1.57 +</body>
    1.58 +</html>

mercurial