layout/base/tests/test_bug66619.html

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:59272abf7d3e
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=66619
5 -->
6 <head>
7 <title>Test for Bug 66619</title>
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
10 </head>
11 <body onload="run()">
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=66619">Mozilla Bug 66619</a>
13 <p id="display"></p>
14 <div id="content" style="display: none">
15
16 </div>
17 <pre id="test">
18 <script class="testbody" type="text/javascript">
19
20 /** Test for Bug 66619 **/
21
22 SimpleTest.waitForExplicitFinish();
23
24 function run()
25 {
26 is(window.scrollY, 0, "window should initially be at top");
27
28 document.getElementById("first").focus();
29 var first = window.scrollY;
30 isnot(first, 0, "we scrolled to first anchor");
31 ok(first + window.innerHeight > 4000,
32 "we scrolled enough to show the anchor");
33
34 window.scrollTo(0, 0);
35 document.getElementById("second").focus();
36 var second = window.scrollY;
37
38 window.scrollTo(0, 0);
39 document.getElementById("third").focus();
40 var third = window.scrollY;
41
42 is(second, first, "we scrolled the second line of the anchor into view");
43 isnot(third, second, "we scrolled the second line of the anchor into view");
44 ok(third > second, "we scrolled the second line of the anchor into view");
45
46 window.scrollTo(0, 0); // make the results visible
47 SimpleTest.finish();
48 }
49
50
51 </script>
52 </pre>
53
54 <div style="height:4000px"></div>
55 <a id="first" href="http://www.mozilla.org/">first<br>link</a>
56 <a id="second" href="http://www.mozilla.org/">second link</a>
57 <a id="third" href="http://www.mozilla.org/">third<br>link</a>
58 <div style="height:4000px"></div>
59
60 </body>
61 </html>
62

mercurial