2 <script src=
"../../resources/js-test.js"></script>
10 window
.scrollTo(0, 0);
11 internals
.setPageScaleFactor(2);
14 // Test Document scroll seperately so we ensure it scrolls all the way in one
16 function testDocumentScroll() {
17 internals
.executeCommand(document
, 'ScrollToEndOfDocument', '');
18 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
19 shouldBe('window.scrollX', '0');
21 internals
.executeCommand(document
, 'ScrollToBeginningOfDocument', '');
22 shouldBe('window.scrollY', '0');
23 shouldBe('window.scrollX', '0');
26 function testScroll(forwardCmd
, backwardCmd
) {
27 internals
.executeCommand(document
, forwardCmd
, '');
29 if (window
.scrollY
=== 0) {
30 debug('FAIL: Command ' + forwardCmd
+ ' failed to scroll page at all.');
34 numScrolls
= Math
.ceil((pageHeight
- window
.innerHeight
) / window
.scrollY
);
36 for(var i
= 0; i
< numScrolls
- 1; ++i
) {
37 internals
.executeCommand(document
, forwardCmd
, '');
40 shouldBe('window.scrollY', 'pageHeight - window.innerHeight');
41 shouldBe('window.scrollX', '0');
43 for(var i
= 0; i
< numScrolls
; ++i
) {
44 internals
.executeCommand(document
, backwardCmd
, '');
47 shouldBe('window.scrollY', '0');
48 shouldBe('window.scrollX', '0');
54 'Test that scrolling editor commands while pinch-zoomed scrolls ' +
55 'both viewports. To test manually, pinch zoom into the page and ' +
56 'use the arrow keys, page up/down, home/end to scroll the page. ' +
57 'You should be able to reach the end of the page bounds (i.e. ' +
58 'scroll to see the divs at the bounds.)');
60 if (window
.internals
) {
63 debug('Testing Document Scrolling:');
68 debug('Testing Page Scrolling:');
69 testScroll('ScrollPageForward', 'ScrollPageBackward');
73 debug('Testing Line Scrolling:');
74 testScroll('ScrollLineDown', 'ScrollLineUp');
78 addEventListener('load', runTest
);
89 background-color: red;
130 <p id=
"description" style=
"width: 800px"></p>
131 <p id=
"console" style=
"width: 800px"></p>
132 <div class=
"top">Top of page
</div>
133 <div class=
"bottom">Bottom of page
</div>
134 <div class=
"left">Left of page
</div>
135 <div class=
"right">Right of page
</div>
136 <div class=
"middle">Middle of page
</div>