blob: fc108239476fae3eb8a9d24ea7a46fd28a3f71bf [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../../js-test-resources/js-test-pre.js"></script>
<script>
function runTest() {
description('Tests that loading a frame with a URL that contains a fragment pointed at a named anchor actually scrolls to that anchor.');
// Check scroll position in a timeout to make sure that the anchor has
// been scrolled to.
setTimeout(function() {
// Make sure that the body is taller than the viewport (i.e. scrolling is
// required).
shouldBeTrue('document.body.offsetHeight > document.documentElement.clientHeight');
// We should be scrolled at least a little bit
shouldBeTrue('document.scrollingElement.scrollTop > 0');
// And the bottom of the viewable area should be at least 2000 pixels from the top, due to the spacer element above.
shouldBeTrue('document.scrollingElement.scrollTop + document.documentElement.clientHeight > 2000');
finishJSTest();
}, 0);
}
var jsTestIsAsync = true;
</script>
</head>
<body onload="runTest()">
<p id="description"></p>
<div id="console"></div>
<div style="height: 2000px">
<!-- Spacer to make sure that the named anchor below requires scrolling -->
</div>
<a name="anchor1">This is an anchor point named "anchor1</a>.
<script src="../../../js-test-resources/js-test-post.js"></script>
</body>
</html>