editor/libeditor/base/tests/test_bug586662.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/base/tests/test_bug586662.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=586662
     1.8 +-->
     1.9 +
    1.10 +<head>
    1.11 +  <title>Test for Bug 586662</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>  
    1.15 +</head>
    1.16 +
    1.17 +<body>
    1.18 +  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586662">Mozilla Bug 586662</a>
    1.19 +  <p id="display"><textarea onkeypress="this.style.overflow = 'hidden'"></textarea></p>
    1.20 +  <div id="content" style="display: none">
    1.21 +  </div>
    1.22 +
    1.23 +  <pre id="test">
    1.24 +    <script type="application/javascript">
    1.25 +
    1.26 +SimpleTest.waitForExplicitFinish();
    1.27 +SimpleTest.waitForFocus(function() {
    1.28 +  var t = document.querySelector("textarea");
    1.29 +  t.focus();
    1.30 +  synthesizeKey("a", {});
    1.31 +  is(getComputedStyle(t, null).overflow, "hidden", "The event handler should be executed");
    1.32 +  is(t.value, "a", "The key entry should result in a character being added to the field");
    1.33 +
    1.34 +  var win = window.open("file_bug586662.html", "_blank",
    1.35 +                        "width=600,height=600,scrollbars=yes");
    1.36 +  SimpleTest.waitForFocus(function() {
    1.37 +    // Make sure that focusing the textarea will cause the page to scroll
    1.38 +    var ed = win.document.getElementById("editor");
    1.39 +    ed.focus();
    1.40 +    setTimeout(function() {
    1.41 +      isnot(win.scrollY, 0, "Page is scrolled down");
    1.42 +      // Scroll back up
    1.43 +      win.scrollTo(0, 0);
    1.44 +      setTimeout(function() {
    1.45 +        is(win.scrollY, 0, "Page is scrolled back up");
    1.46 +        // Make sure that typing something into the textarea will cause the
    1.47 +        // page to scroll down
    1.48 +        synthesizeKey("a", {}, win);
    1.49 +        setTimeout(function() {
    1.50 +          isnot(win.scrollY, 0, "Page is scrolled down again");
    1.51 +
    1.52 +          win.close();
    1.53 +          SimpleTest.finish();
    1.54 +        }, 0);
    1.55 +      }, 0);
    1.56 +    }, 0);
    1.57 +  }, win);
    1.58 +});
    1.59 +
    1.60 +   </script>
    1.61 +  </pre>
    1.62 +</body>
    1.63 +</html>

mercurial