Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: LayoutTests/fast/scroll-behavior/overflow-scroll-scrollLeft.html

Issue 378953002: Test framework and tests for CSSOM View smooth scroll (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add NeedsRebaseline for listbox test on Mac and Win Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 function getEndPosition(testCase, startPosition) {
22 var endPosition = {};
23 endPosition.x = testCase.x;
24 endPosition.y = startPosition.y;
25 return endPosition;
26 }
27
28 function jsScroll(testCase) {
29 var element = document.getElementById("container");
30 if (testCase.js) {
31 element.scrollLeft = {x: testCase.x, behavior: testCase.js};
32 } else {
33 element.scrollLeft = testCase.x;
34 }
35 }
36
37 const testScrolls = [
38 {js: "instant", css: "instant", x: 1, y: 0},
39 {js: "instant", css: "smooth", x: 2, y: 0},
40 {js: "auto", css: "instant", x: 3, y: 0},
41 {js: "", css: "instant", x: 4, y: 0},
42 {js: "smooth", css: "instant", waitForEnd: true, x: 10, y: 0},
43 {js: "smooth", css: "smooth", waitForEnd: true, x: 20, y: 0},
44 {js: "auto", css: "smooth", waitForEnd: true, x: 30, y: 0},
45 {js: "", css: "smooth", waitForEnd: true, x: 40, y: 0},
46 {js: "smooth", css: "instant", waitForEnd: false, x: 4000, y: 0},
47 {js: "smooth", css: "smooth", waitForEnd: false, x: 15, y: 0},
48 {js: "auto", css: "smooth", waitForEnd: false, x: 4100, y: 0},
49 {js: "", css: "smooth", waitForEnd: false, x: 10, y: 0},
50 ];
51
52 function doTest()
53 {
54 var testCases = [];
55 for (var i = 0; i < testScrolls.length; i++) {
56 testCases.push(new ScrollBehaviorTestCase(testScrolls[i]));
57 }
58
59 var element = document.getElementById("container");
60 var scrollBehaviorTest = new ScrollBehaviorTest(element,
61 element,
62 testCases,
63 getEndPosition,
64 jsScroll);
65 scrollBehaviorTest.run();
66 }
67
68 window.addEventListener('load', doTest, false);
69 </script>
70 </head>
71
72 <body>
73 <p>Test that setting scrollLeft on an overflow:scroll element works with both scroll behaviors</p>
74 <div id="container">
75 <div id="content"></div>
76 </div>
77 </body>
78 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698