blob: 92ba62f062893c3a9914ca325797e47337ce1153 [file] [log] [blame]
* Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
* for details. All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
* @description This test verifies that links to anchors without content work
* as expected.
import "dart:html";
import "../../testcommon.dart";
main() {
var style = new Element.html('''
.spacer {
line-height: 100em;
''', treeSanitizer: new NullTreeSanitizer());
<a id="goto-1" href="#block1">Block 1</a><br>
<a id="goto-2" href="#block2">Block 2</a><br>
<a name="block1"></a><span class="h">Block 1</span><br>
<span class="spacer"></span>
<a name="block2"></a><span class="h">Block 2</span><br>
<span class="spacer"></span>
''', treeSanitizer: new NullTreeSanitizer());
var scrollTopBeforeClick = document.documentElement.scrollTop;
if (document.documentElement.scrollTop > scrollTopBeforeClick)
testPassed('Clicking link 1 scrolled to block 1.');
testFailed('Clicking link 1 didn\'t scroll as expected.');
scrollTopBeforeClick = document.documentElement.scrollTop;
if (document.documentElement.scrollTop > scrollTopBeforeClick)
testPassed('Clicking link 2 scrolled to block 2.');
testFailed('Clicking link 2 didn\'t scroll as expected.');