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

Unified Diff: LayoutTests/fast/scroll-behavior/parse-scroll-behavior.html

Issue 140253004: Implement 'scroll-behavior' parsing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address review comments Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/scroll-behavior/parse-scroll-behavior-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..80c905aa59c09b5d4900cadc3b964d130fce529c
--- /dev/null
+++ b/LayoutTests/fast/scroll-behavior/parse-scroll-behavior.html
@@ -0,0 +1,73 @@
+<!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'");
+
+debug("");
+debug("Test that scroll-behavior is not inherited by default");
+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);
+shouldBe("getComputedStyle(element, '').getPropertyValue('scroll-behavior')", "'instant'");
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | LayoutTests/fast/scroll-behavior/parse-scroll-behavior-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698