tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_bug586662.html (1962B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=586662
      5 -->
      6 
      7 <head>
      8  <title>Test for Bug 586662</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11  <script src="/tests/SimpleTest/EventUtils.js"></script>  
     12 </head>
     13 
     14 <body>
     15  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=586662">Mozilla Bug 586662</a>
     16  <p id="display"><textarea onkeypress="this.style.overflow = 'hidden'"></textarea></p>
     17  <div id="content" style="display: none">
     18  </div>
     19 
     20  <pre id="test">
     21    <script type="application/javascript">
     22 
     23 SimpleTest.waitForExplicitFinish();
     24 SimpleTest.waitForFocus(function() {
     25  var t = document.querySelector("textarea");
     26  t.focus();
     27  sendString("a");
     28  is(getComputedStyle(t, null).overflow, "hidden", "The event handler should be executed");
     29  is(t.value, "a", "The key entry should result in a character being added to the field");
     30 
     31  var win = window.open("file_bug586662.html", "_blank",
     32                        "width=600,height=600,scrollbars=yes");
     33  SimpleTest.waitForFocus(function() {
     34    // Make sure that focusing the textarea will cause the page to scroll
     35    var ed = win.document.getElementById("editor");
     36    ed.focus();
     37    setTimeout(function() {
     38      isnot(win.scrollY, 0, "Page is scrolled down");
     39      // Scroll back up
     40      win.scrollTo(0, 0);
     41      setTimeout(function() {
     42        is(win.scrollY, 0, "Page is scrolled back up");
     43        // Make sure that typing something into the textarea will cause the
     44        // page to scroll down
     45        synthesizeKey("a", {}, win);
     46        requestAnimationFrame(function() {
     47          requestAnimationFrame(function() {
     48            isnot(win.scrollY, 0, "Page is scrolled down again");
     49 
     50            win.close();
     51            SimpleTest.finish();
     52          });
     53        });
     54      }, 0);
     55    }, 0);
     56  }, win);
     57 });
     58 
     59   </script>
     60  </pre>
     61 </body>
     62 </html>