9 border:
1px solid silver;
11 #test_section
> article {
29 padding:
5px
10px
15px
20px;
30 border:
1px solid silver;
35 padding:
5px
10px
15px
20px;
36 border:
1px solid silver;
39 <script src=
"../../resources/js-test.js"></script>
42 <section id=
"test_section">
44 <span id=
"top-left">top left
</span>
45 <span id=
"bottom-right">bottom right
</span>
49 <input id=
"test_input" type=
"text" value=
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit">
50 <input id=
"test_input_search" type=
"search" value=
"Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit">
53 Tests that large scrollLeft/Top values scroll to maximum possible value, i.e, Element.scrollWidth/Height - Element.clientWidth/Height.
57 testScrollToMax('test_section');
58 testScrollToMax('test_input');
59 testScrollToMax('test_input_search');
61 function testScrollToMax(id
) {
62 var el
= document
.getElementById(id
);
63 expectedScrollLeft
= el
.scrollWidth
- el
.clientWidth
;
64 expectedScrollTop
= el
.scrollHeight
- el
.clientHeight
;
66 el
.scrollLeft
= 100000000;
67 el
.scrollTop
= 100000000;
69 if (el
.scrollLeft
== expectedScrollLeft
) {
70 testPassed('Setting ' + el
.id
+ '.scrollLeft = 100000000 ' +
71 'scrolls all the way to the right.');
73 testFailed('Setting ' + el
.id
+ '.scrollLeft = 100000000 ' +
74 'scrolls to ' + el
.scrollLeft
+ ', expected ' +
75 expectedScrollLeft
+ '.');
78 if (el
.scrollTop
== expectedScrollTop
) {
79 testPassed('Setting ' + el
.id
+ '.scrollTop = 100000000 ' +
80 'scrolls all the way to the bottom.');
82 testFailed('Setting ' + el
.id
+ '.scrollTop = 100000000 ' +
83 'scrolls to ' + el
.scrollTop
+ ', expected ' +
84 expectedScrollTop
+ '.');