Chromium Code Reviews| Index: LayoutTests/fast/scroll-behavior/parse-scroll-behavior.html |
| diff --git a/LayoutTests/fast/scroll-behavior/parse-scroll-behavior.html b/LayoutTests/fast/scroll-behavior/parse-scroll-behavior.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c0656335f17e9a5c5f74d3f5bdd59893e8829f87 |
| --- /dev/null |
| +++ b/LayoutTests/fast/scroll-behavior/parse-scroll-behavior.html |
| @@ -0,0 +1,63 @@ |
| +<!DOCTYPE html> |
| +<html> |
| +<head> |
| +<style> |
| +#scrollBehaviorInstant { |
| + scroll-behavior: instant; |
| +} |
| + |
| +#scrollBehaviorSmooth { |
| + scroll-behavior: smooth; |
| +} |
| +</style> |
| +<script src="../../resources/js-test.js"></script> |
| +</head> |
| +<body> |
| +<div id="scrollBehaviorInstant"></div> |
| +<div id="scrollBehaviorSmooth"></div> |
| +<script> |
| +description('Test that setting and getting scroll-behavior works as expected'); |
| + |
| +debug("Test getting scroll-behavior set through CSS"); |
| +var scrollBehaviorInstant = document.getElementById("scrollBehaviorInstant"); |
| +shouldBe("getComputedStyle(scrollBehaviorInstant, '').getPropertyValue('scroll-behavior')", "'instant'"); |
| + |
| +var scrollBehaviorSmooth = document.getElementById("scrollBehaviorSmooth"); |
| +shouldBe("getComputedStyle(scrollBehaviorSmooth, '').getPropertyValue('scroll-behavior')", "'smooth'"); |
| + |
| +debug(""); |
| +debug("Test initial value of scroll-behavior"); |
| +var element = document.createElement("div"); |
| +document.body.appendChild(element); |
| +shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'instant'"); |
| + |
| +debug(""); |
| +debug("Test getting and setting scroll-behavior through JS"); |
| +element = document.createElement("div"); |
| +document.body.appendChild(element); |
| +element.style.scrollBehavior = "smooth"; |
| +shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'smooth'"); |
| + |
| +element.style.scrollBehavior = "instant"; |
| +shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'instant'"); |
| + |
| +debug(""); |
| +debug("Test the value 'initial'"); |
| +element.style.scrollBehavior = "smooth"; |
| +shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'smooth'"); |
| +element.style.scrollBehavior = "initial"; |
| +shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'instant'"); |
| + |
| +debug(""); |
| +debug("Test the value 'inherit'"); |
| +var parentElement = document.createElement("div"); |
| +document.body.appendChild(parentElement); |
| +parentElement.style.scrollBehavior = "smooth"; |
| +shouldBe("getComputedStyle(parentElement, '').getPropertyValue('scroll-behavior')", "'smooth'"); |
| +element = document.createElement("div"); |
| +parentElement.appendChild(element); |
| +element.style.scrollBehavior = "inherit"; |
| +shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'smooth'"); |
| +</script> |
| +</body> |
|
Julien - ping for review
2014/01/22 16:24:35
I would throw an inheritance test for good measure
ajuma
2014/01/22 19:50:20
Done.
|
| +</html> |