OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../../js-test-resources/js-test-pre.js"></script> | 4 <script src="../../../js-test-resources/js-test-pre.js"></script> |
5 <script> | 5 <script> |
6 function runTest() { | 6 function runTest() { |
7 description('Tests that loading a frame with a URL that contains a fragmen
t pointed at a named anchor actually scrolls to that anchor.'); | 7 description('Tests that loading a frame with a URL that contains a fragmen
t pointed at a named anchor actually scrolls to that anchor.'); |
8 | 8 |
9 // Check scroll position in a timeout to make sure that the anchor has | 9 // Check scroll position in a timeout to make sure that the anchor has |
10 // been scrolled to. | 10 // been scrolled to. |
11 setTimeout(function() { | 11 setTimeout(function() { |
12 // Make sure that the body is taller than the viewport (i.e. scrolling
is | 12 // Make sure that the body is taller than the viewport (i.e. scrolling
is |
13 // required). | 13 // required). |
14 shouldBeTrue('document.body.offsetHeight > document.documentElement.cl
ientHeight'); | 14 shouldBeTrue('document.documentElement.offsetHeight > document.documen
tElement.clientHeight'); |
15 | 15 |
16 // We should be scrolled at least a little bit | 16 // We should be scrolled at least a little bit |
17 shouldBeTrue('document.body.scrollTop > 0'); | 17 shouldBeTrue('document.documentElement.scrollTop > 0'); |
18 | 18 |
19 // And the bottom of the viewable area should be at least 2000 pixels
from the top, due to the spacer element above. | 19 // And the bottom of the viewable area should be at least 2000 pixels
from the top, due to the spacer element above. |
20 shouldBeTrue('document.body.scrollTop + document.documentElement.clien
tHeight > 2000'); | 20 shouldBeTrue('document.documentElement.scrollTop + document.documentEl
ement.clientHeight > 2000'); |
21 | 21 |
22 finishJSTest(); | 22 finishJSTest(); |
23 }, 0); | 23 }, 0); |
24 } | 24 } |
25 | 25 |
26 var jsTestIsAsync = true; | 26 var jsTestIsAsync = true; |
27 </script> | 27 </script> |
28 </head> | 28 </head> |
29 <body onload="runTest()"> | 29 <body onload="runTest()"> |
30 <p id="description"></p> | 30 <p id="description"></p> |
31 <div id="console"></div> | 31 <div id="console"></div> |
32 | 32 |
33 <div style="height: 2000px"> | 33 <div style="height: 2000px"> |
34 <!-- Spacer to make sure that the named anchor below requires scrolling --> | 34 <!-- Spacer to make sure that the named anchor below requires scrolling --> |
35 </div> | 35 </div> |
36 | 36 |
37 <a name="anchor1">This is an anchor point named "anchor1</a>. | 37 <a name="anchor1">This is an anchor point named "anchor1</a>. |
38 <script src="../../../js-test-resources/js-test-post.js"></script> | 38 <script src="../../../js-test-resources/js-test-post.js"></script> |
39 </body> | 39 </body> |
40 </html> | 40 </html> |
OLD | NEW |