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

Unified Diff: LayoutTests/fast/dom/Window/window-scroll-arguments.html

Issue 146003002: Bindings for CSSOM View smooth scroll API (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
Index: LayoutTests/fast/dom/Window/window-scroll-arguments.html
diff --git a/LayoutTests/fast/dom/Window/window-scroll-arguments.html b/LayoutTests/fast/dom/Window/window-scroll-arguments.html
index 26855c37975409c0081953fa5ffbbb7ceaa4e3da..25f825ce8ef73e857428c3170b19c04e6af82782 100644
--- a/LayoutTests/fast/dom/Window/window-scroll-arguments.html
+++ b/LayoutTests/fast/dom/Window/window-scroll-arguments.html
@@ -25,7 +25,8 @@
reset();
description("This test makes sure that calling the window scrolling\
- methods with less than 2 arguments throws exception.");
+ methods with less than 2 arguments or with an invalid third argument\
+ throws an exception.");
// scrollTo /////////////////////////
debug('');
@@ -40,11 +41,16 @@
shouldThrow('window.scrollTo(x)');;
reset();
- debug("Testing - scrollTo with more than 2 arguments");
- window.scrollTo(x, y, 200, "text");
- shouldBe('window.scrollX', 'x');
- shouldBe('window.scrollY', 'y');
- reset();
+ debug("Testing - scrollTo with a valid ScrollOptions argument");
+ shouldNotThrow('window.scrollTo(x, y, { })');
+ shouldNotThrow('window.scrollTo(x, y, { behavior: "auto" })');
+ shouldNotThrow('window.scrollTo(x, y, { behavior: "instant" })');
+ shouldNotThrow('window.scrollTo(x, y, { behavior: "smooth" })');
+
+ debug("Testing - scrollTo with an invalid ScrollOptions argument");
+ shouldThrow('window.scrollTo(x, y, { behavior: "" })');
+ shouldThrow('window.scrollTo(x, y, { behavior: "abcd" })');
+ shouldThrow('window.scrollTo(x, y, 200, "text")');
// scroll /////////////////////////
debug('');
@@ -59,11 +65,16 @@
shouldThrow('window.scroll(x)');
reset();
- debug("Testing - scroll with more than 2 arguments");
- window.scroll(x, y, 200, "text");
- shouldBe('window.scrollX', 'x');
- shouldBe('window.scrollY', 'y');
- reset();
+ debug("Testing - scroll with a valid ScrollOptions argument");
+ shouldNotThrow('window.scroll(x, y, { })');
+ shouldNotThrow('window.scroll(x, y, { behavior: "auto" })');
+ shouldNotThrow('window.scroll(x, y, { behavior: "instant" })');
+ shouldNotThrow('window.scroll(x, y, { behavior: "smooth" })');
+
+ debug("Testing - scroll with an invalid ScrollOptions argument");
+ shouldThrow('window.scroll(x, y, { behavior: "" })');
+ shouldThrow('window.scroll(x, y, { behavior: "abcd" })');
+ shouldThrow('window.scroll(x, y, 200, "text")');
// scrollBy /////////////////////////
debug('');
@@ -78,11 +89,16 @@
shouldThrow('window.scrollBy(x)');
reset();
- debug("Testing - scrollBy with more than 2 arguments");
- window.scrollBy(x, y, 200, "text");
- shouldBe('window.scrollX', 'resetX + x');
- shouldBe('window.scrollY', 'resetY + y');
- reset();
+ debug("Testing - scrollBy with a valid ScrollOptions argument");
+ shouldNotThrow('window.scrollBy(x, y, { })');
+ shouldNotThrow('window.scrollBy(x, y, { behavior: "auto" })');
+ shouldNotThrow('window.scrollBy(x, y, { behavior: "instant" })');
+ shouldNotThrow('window.scrollBy(x, y, { behavior: "smooth" })');
+
+ debug("Testing - scrollBy with an invalid ScrollOptions argument");
+ shouldThrow('window.scrollBy(x, y, { behavior: "" })');
+ shouldThrow('window.scrollBy(x, y, { behavior: "abcd" })');
+ shouldThrow('window.scrollBy(x, y, 200, "text")');
</script>
</body>
</html>

Powered by Google App Engine
This is Rietveld 408576698