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

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

Issue 766023002: Rename 'instant' value of scroll-behavior CSS property to 'auto' (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <style> 4 <style>
5 #scrollBehaviorInstant { 5 #scrollBehaviorAuto {
6 scroll-behavior: instant; 6 scroll-behavior: auto;
7 } 7 }
8 8
9 #scrollBehaviorSmooth { 9 #scrollBehaviorSmooth {
10 scroll-behavior: smooth; 10 scroll-behavior: smooth;
11 } 11 }
12 </style> 12 </style>
13 <script src="../../resources/js-test.js"></script> 13 <script src="../../resources/js-test.js"></script>
14 </head> 14 </head>
15 <body> 15 <body>
16 <div id="scrollBehaviorInstant"></div> 16 <div id="scrollBehaviorAuto"></div>
17 <div id="scrollBehaviorSmooth"></div> 17 <div id="scrollBehaviorSmooth"></div>
18 <script> 18 <script>
19 description('Test that setting and getting scroll-behavior works as expected'); 19 description('Test that setting and getting scroll-behavior works as expected');
20 20
21 debug("Test getting scroll-behavior set through CSS"); 21 debug("Test getting scroll-behavior set through CSS");
22 var scrollBehaviorInstant = document.getElementById("scrollBehaviorInstant"); 22 var scrollBehaviorAuto = document.getElementById("scrollBehaviorAuto");
23 shouldBe("getComputedStyle(scrollBehaviorInstant, '').getPropertyValue('scroll-b ehavior')", "'instant'"); 23 shouldBe("getComputedStyle(scrollBehaviorAuto, '').getPropertyValue('scroll-beha vior')", "'auto'");
24 24
25 var scrollBehaviorSmooth = document.getElementById("scrollBehaviorSmooth"); 25 var scrollBehaviorSmooth = document.getElementById("scrollBehaviorSmooth");
26 shouldBe("getComputedStyle(scrollBehaviorSmooth, '').getPropertyValue('scroll-be havior')", "'smooth'"); 26 shouldBe("getComputedStyle(scrollBehaviorSmooth, '').getPropertyValue('scroll-be havior')", "'smooth'");
27 27
28 debug(""); 28 debug("");
29 debug("Test initial value of scroll-behavior"); 29 debug("Test initial value of scroll-behavior");
30 var element = document.createElement("div"); 30 var element = document.createElement("div");
31 document.body.appendChild(element); 31 document.body.appendChild(element);
32 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' instant'"); 32 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' auto'");
33 33
34 debug(""); 34 debug("");
35 debug("Test getting and setting scroll-behavior through JS"); 35 debug("Test getting and setting scroll-behavior through JS");
36 element = document.createElement("div"); 36 element = document.createElement("div");
37 document.body.appendChild(element); 37 document.body.appendChild(element);
38 element.style.scrollBehavior = "smooth"; 38 element.style.scrollBehavior = "smooth";
39 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' smooth'"); 39 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' smooth'");
40 40
41 element.style.scrollBehavior = "instant"; 41 element.style.scrollBehavior = "auto";
42 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' instant'"); 42 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' auto'");
43 43
44 debug(""); 44 debug("");
45 debug("Test the value 'initial'"); 45 debug("Test the value 'initial'");
46 element.style.scrollBehavior = "smooth"; 46 element.style.scrollBehavior = "smooth";
47 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' smooth'"); 47 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' smooth'");
48 element.style.scrollBehavior = "initial"; 48 element.style.scrollBehavior = "initial";
49 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' instant'"); 49 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' auto'");
50 50
51 debug(""); 51 debug("");
52 debug("Test the value 'inherit'"); 52 debug("Test the value 'inherit'");
53 var parentElement = document.createElement("div"); 53 var parentElement = document.createElement("div");
54 document.body.appendChild(parentElement); 54 document.body.appendChild(parentElement);
55 parentElement.style.scrollBehavior = "smooth"; 55 parentElement.style.scrollBehavior = "smooth";
56 shouldBe("getComputedStyle(parentElement, '').getPropertyValue('scroll-behavior' )", "'smooth'"); 56 shouldBe("getComputedStyle(parentElement, '').getPropertyValue('scroll-behavior' )", "'smooth'");
57 element = document.createElement("div"); 57 element = document.createElement("div");
58 parentElement.appendChild(element); 58 parentElement.appendChild(element);
59 element.style.scrollBehavior = "inherit"; 59 element.style.scrollBehavior = "inherit";
60 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' smooth'"); 60 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' smooth'");
61 61
62 debug(""); 62 debug("");
63 debug("Test that scroll-behavior is not inherited by default"); 63 debug("Test that scroll-behavior is not inherited by default");
64 var parentElement = document.createElement("div"); 64 var parentElement = document.createElement("div");
65 document.body.appendChild(parentElement); 65 document.body.appendChild(parentElement);
66 parentElement.style.scrollBehavior = "smooth"; 66 parentElement.style.scrollBehavior = "smooth";
67 shouldBe("getComputedStyle(parentElement, '').getPropertyValue('scroll-behavior' )", "'smooth'"); 67 shouldBe("getComputedStyle(parentElement, '').getPropertyValue('scroll-behavior' )", "'smooth'");
68 element = document.createElement("div"); 68 element = document.createElement("div");
69 parentElement.appendChild(element); 69 parentElement.appendChild(element);
70 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' instant'"); 70 shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "' auto'");
71 </script> 71 </script>
72 </body> 72 </body>
73 </html> 73 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698