layout/generic/test/test_bug468167.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.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=468167
     5 -->
     6 <head>
     7   <title>Test for Bug 468167</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468167">Mozilla Bug 468167</a>
    14 <p id="display">
    15 <textarea id="ta" rows="10" cols="80"></textarea>
    16 </p>
    17 <pre id="test">
    18 <script type="application/javascript">
    20 /** Test for Bug 468167 **/
    22 SimpleTest.waitForExplicitFinish();
    23 SimpleTest.waitForFocus(runTests);
    25 function runTests()
    26 {
    27   var ta = document.getElementById("ta");
    28   ta.focus();
    29   is(ta.scrollTop, 0, "initially scrolled to top");
    30   var s = "";
    31   for (var i = 0; i < 40; ++i) {
    32     // three characters per line
    33     if (i < 10)
    34       s += "0";
    35     s += i + "\n";
    36   }
    37   ta.value = s;
    38   is(ta.scrollTop, 0, "scrolled to top after adding content");
    39   ta.scrollTop = 9999; // scroll down as far as we can
    40   isnot(ta.scrollTop, 0, "scrolled down after scrolling down");
    42   ta.setSelectionRange(0, 99); // 33 lines out of 40
    44   // Send a backspace key event to delete the selection
    45   synthesizeKey("VK_BACK_SPACE", { });
    47   is(ta.scrollTop, 0, "scrolled to top after deleting selection");
    49   SimpleTest.finish();
    50 }
    52 </script>
    53 </pre>
    54 </body>
    55 </html>

mercurial