OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 #container { |
| 6 width: 200px; |
| 7 height: 200px; |
| 8 overflow: scroll; |
| 9 } |
| 10 |
| 11 #content { |
| 12 width: 7500px; |
| 13 height: 7500px; |
| 14 background-color: blue; |
| 15 } |
| 16 </style> |
| 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 const instantScrolls = [ |
| 22 {js: "instant", css: "instant", y: 2}, |
| 23 {js: "instant", css: "smooth", y: 3}, |
| 24 {js: "auto", css: "instant", y: 4}, |
| 25 {js: "", css: "instant", y: 5} |
| 26 ]; |
| 27 |
| 28 const smoothScrolls = [ |
| 29 {js: "smooth", css: "instant", waitForEnd: true, y: 15}, |
| 30 {js: "smooth", css: "smooth", waitForEnd: true, y: 25}, |
| 31 {js: "auto", css: "smooth", waitForEnd: true, y: 35}, |
| 32 {js: "", css: "smooth", waitForEnd: true, y: 45}, |
| 33 {js: "smooth", css: "instant", waitForEnd: false, y: 4100}, |
| 34 {js: "smooth", css: "smooth", waitForEnd: false, y: 20}, |
| 35 {js: "auto", css: "smooth", waitForEnd: false, y: 4000}, |
| 36 {js: "", css: "smooth", waitForEnd: false, y: 5}, |
| 37 ]; |
| 38 |
| 39 function runTestCase(testCase) |
| 40 { |
| 41 var element = document.getElementById("container"); |
| 42 if (testCase.js) |
| 43 element.scrollTop = {y: testCase.y, behavior: testCase.js}; |
| 44 else |
| 45 element.scrollTop = testCase.y; |
| 46 } |
| 47 |
| 48 function endX(testCase, startX) |
| 49 { |
| 50 return startX; |
| 51 } |
| 52 |
| 53 function endY(testCase) |
| 54 { |
| 55 return testCase.y; |
| 56 } |
| 57 |
| 58 function doTest() |
| 59 { |
| 60 var element = document.getElementById("container"); |
| 61 runScrollBehaviorTests(element, |
| 62 element, |
| 63 instantScrolls, |
| 64 smoothScrolls, |
| 65 runTestCase, |
| 66 endX, |
| 67 endY); |
| 68 } |
| 69 |
| 70 window.addEventListener('load', doTest, false); |
| 71 </script> |
| 72 </head> |
| 73 |
| 74 <body> |
| 75 <p>Test that setting scrollTop on an overflow:scroll element works with both s
croll behaviors</p> |
| 76 <div id="container"> |
| 77 <div id="content"></div> |
| 78 </div> |
| 79 </body> |
| 80 </html> |
OLD | NEW |