1 <script src=
"../../../resources/js-test.js"></script>
6 outline:
1px solid black;
9 <div id=
"console"></div>
12 <p id=
"test">Test content
</p>
13 <div id=
"pusher">This box is here to create scrollbars.
</div>
16 if (window
.testRunner
)
17 testRunner
.dumpAsText();
19 var element
= document
.getElementById('test');
22 var unScrolledBoundingBox
= element
.getBoundingClientRect();
23 var unScrolledBoundingBoxes
= element
.getClientRects();
25 // Test scrolling down
26 window
.scrollBy(0, 50);
27 var scrolledDownBoundingBox
= element
.getBoundingClientRect();
28 var scrolledDownBoundingBoxes
= element
.getClientRects();
31 window
.scrollTo(0, 0);
33 // Test scrolling right
34 window
.scrollBy(50, 0);
35 var scrolledRightBoundingBox
= element
.getBoundingClientRect();
36 var scrolledRightBoundingBoxes
= element
.getClientRects();
39 window
.scrollTo(0, 0);
41 shouldBe("unScrolledBoundingBox.top - scrolledDownBoundingBox.top", "50");
42 shouldBe("unScrolledBoundingBoxes[0].top - scrolledDownBoundingBoxes[0].top", "50");
43 shouldBe("unScrolledBoundingBox.left - scrolledRightBoundingBox.left", "50");
44 shouldBe("unScrolledBoundingBoxes[0].left - scrolledRightBoundingBoxes[0].left", "50");
46 if (window
.testRunner
) {
47 var area
= document
.getElementById('testArea');
48 area
.parentNode
.removeChild(area
);