14 background-color: blue;
17 <script src=
"../../resources/testharness.js"></script>
18 <script src=
"../../resources/testharnessreport.js"></script>
19 <script src=
"resources/scroll-behavior-test.js"></script>
20 <script type=
"text/javascript">
21 function getEndPosition(testCase
, startPosition
) {
24 endPosition
.x
= testCase
.x
;
26 endPosition
.x
= startPosition
.x
;
29 endPosition
.y
= testCase
.y
;
31 endPosition
.y
= startPosition
.y
;
36 function jsScroll(testCase
) {
38 var scrollToOptions
= {behavior
: testCase
.js
};
40 scrollToOptions
.left
= testCase
.x
;
42 scrollToOptions
.top
= testCase
.y
;
43 document
.getElementById("container").scrollTo(scrollToOptions
);
45 document
.getElementById("container").scrollTo(testCase
.x
, testCase
.y
);
50 {js
: "instant", css
: "auto", x
: 1, y
: 2},
51 {js
: "instant", css
: "smooth", x
: 2, y
: 3},
52 {js
: "auto", css
: "auto", x
: 3, y
: 4},
53 {js
: "", css
: "auto", x
: 4, y
: 5},
54 {js
: "auto", css
: "auto", x
: 3},
55 {js
: "auto", css
: "auto", y
: 4},
56 {js
: "auto", css
: "auto"},
57 {js
: "smooth", css
: "auto", waitForEnd
: true, x
: 10, y
: 15},
58 {js
: "smooth", css
: "smooth", waitForEnd
: true, x
: 20, y
: 25},
59 {js
: "auto", css
: "smooth", waitForEnd
: true, x
: 30, y
: 35},
60 {js
: "", css
: "smooth", waitForEnd
: true, x
: 40, y
: 45},
61 {js
: "auto", css
: "smooth", waitForEnd
: true, x
: 45},
62 {js
: "auto", css
: "smooth", waitForEnd
: true, y
: 40},
63 {js
: "smooth", css
: "auto", waitForEnd
: false, x
: 4000, y
: 4100},
64 {js
: "smooth", css
: "smooth", waitForEnd
: false, x
: 15, y
: 20},
65 {js
: "auto", css
: "smooth", waitForEnd
: false, x
: 4100, y
: 4000},
66 {js
: "", css
: "smooth", waitForEnd
: false, x
: 10, y
: 5},
72 for (var i
= 0; i
< testScrolls
.length
; i
++) {
73 testCases
.push(new ScrollBehaviorTestCase(testScrolls
[i
]));
76 var element
= document
.getElementById("container");
77 var scrollBehaviorTest
= new ScrollBehaviorTest(element
,
82 scrollBehaviorTest
.run();
85 window
.addEventListener('load', doTest
, false);
90 <p>Test that calling scrollTo on an overflow:scroll element works with both scroll behaviors
</p>
92 <div id=
"content"></div>