OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/testharness.js"></script> | 4 <script src="../../resources/testharness.js"></script> |
5 <script src="../../resources/testharnessreport.js"></script> | 5 <script src="../../resources/testharnessreport.js"></script> |
6 <script src="resources/scroll-behavior-test.js"></script> | 6 <script src="resources/scroll-behavior-test.js"></script> |
7 <script type="text/javascript"> | 7 <script type="text/javascript"> |
8 const numItems = 500; | 8 const numItems = 500; |
9 | 9 |
10 function getEndPosition(testCase, startPosition) { | 10 function getEndPosition(testCase, startPosition) { |
11 var endPosition = {}; | 11 var endPosition = {}; |
12 endPosition.x = startPosition.x; | 12 endPosition.x = startPosition.x; |
13 endPosition.y = testCase.y; | 13 endPosition.y = testCase.y; |
14 return endPosition; | 14 return endPosition; |
15 } | 15 } |
16 | 16 |
17 function jsScroll(testCase) { | 17 function jsScroll(testCase) { |
18 var element = document.getElementById("listbox"); | 18 var element = document.getElementById("listbox"); |
19 if (testCase.js) { | 19 if (testCase.js) { |
20 element.scrollTop = {y: testCase.y, behavior: testCase.js}; | 20 element.scrollTop = {y: testCase.y, behavior: testCase.js}; |
21 } else { | 21 } else { |
22 element.scrollTop = testCase.y; | 22 element.scrollTop = testCase.y; |
23 } | 23 } |
24 } | 24 } |
25 | 25 |
26 var testScrolls = [ | 26 var testScrolls = [ |
27 {js: "instant", css: "instant", index: 2}, | 27 {js: "instant", css: "auto", index: 2}, |
28 {js: "instant", css: "smooth", index: 3}, | 28 {js: "instant", css: "smooth", index: 3}, |
29 {js: "auto", css: "instant", index: 4}, | 29 {js: "auto", css: "auto", index: 4}, |
30 {js: "", css: "instant", index: 5}, | 30 {js: "", css: "auto", index: 5}, |
31 {js: "smooth", css: "instant", waitForEnd: true, index: 15}, | 31 {js: "smooth", css: "auto", waitForEnd: true, index: 15}, |
32 {js: "smooth", css: "smooth", waitForEnd: true, index: 20}, | 32 {js: "smooth", css: "smooth", waitForEnd: true, index: 20}, |
33 {js: "auto", css: "smooth", waitForEnd: true, index: 30}, | 33 {js: "auto", css: "smooth", waitForEnd: true, index: 30}, |
34 {js: "", css: "smooth", waitForEnd: true, index: 35}, | 34 {js: "", css: "smooth", waitForEnd: true, index: 35}, |
35 {js: "smooth", css: "instant", waitForEnd: false, index: 410}, | 35 {js: "smooth", css: "auto", waitForEnd: false, index: 410}, |
36 {js: "smooth", css: "smooth", waitForEnd: false, index: 20}, | 36 {js: "smooth", css: "smooth", waitForEnd: false, index: 20}, |
37 {js: "auto", css: "smooth", waitForEnd: false, index: 400}, | 37 {js: "auto", css: "smooth", waitForEnd: false, index: 400}, |
38 {js: "", css: "smooth", waitForEnd: false, index: 5}, | 38 {js: "", css: "smooth", waitForEnd: false, index: 5}, |
39 ]; | 39 ]; |
40 | 40 |
41 function initializeContents(listbox) | 41 function initializeContents(listbox) |
42 { | 42 { |
43 for (var i = 0; i < numItems; i++) { | 43 for (var i = 0; i < numItems; i++) { |
44 var option = document.createElement("option"); | 44 var option = document.createElement("option"); |
45 option.appendChild(document.createTextNode(i)); | 45 option.appendChild(document.createTextNode(i)); |
(...skipping 24 matching lines...) Expand all Loading... |
70 | 70 |
71 window.addEventListener('load', doTest, false); | 71 window.addEventListener('load', doTest, false); |
72 </script> | 72 </script> |
73 </head> | 73 </head> |
74 | 74 |
75 <body> | 75 <body> |
76 <p>Test that setting scrollTop on a listbox works with both scroll behaviors</
p> | 76 <p>Test that setting scrollTop on a listbox works with both scroll behaviors</
p> |
77 <select size="4" id="listbox"></select> | 77 <select size="4" id="listbox"></select> |
78 </body> | 78 </body> |
79 </html> | 79 </html> |
OLD | NEW |