Index: third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-creation.html |
diff --git a/third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-creation.html b/third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-creation.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..bc26e2dfdf286ac60d77f604926b7a5098ee74b2 |
--- /dev/null |
+++ b/third_party/WebKit/LayoutTests/fast/animation/scroll-animations/scrolltimeline-creation.html |
@@ -0,0 +1,53 @@ |
+<!DOCTYPE html> |
+<style> |
+.scroller { |
+ height: 100px; |
+ width: 100px; |
+ overflow: scroll; |
+} |
+ |
+.content { |
+ height: 500px; |
+ width: 500px; |
+} |
+</style> |
+ |
+<div class='scroller'> |
+ <div class='content'></div> |
+</div> |
+ |
+<script src='../../../resources/testharness.js'></script> |
+<script src='../../../resources/testharnessreport.js'></script> |
+<script> |
+test(function() { |
+ const scroller = document.querySelector('.scroller'); |
+ const scrollTimeline = new ScrollTimeline( |
+ { scrollSource: scroller, timeRange: 100, orientation: 'inline' }); |
+ |
+ assert_equals(scrollTimeline.scrollSource, scroller); |
+ assert_equals(scrollTimeline.timeRange, 100); |
+ assert_equals(scrollTimeline.orientation, 'inline'); |
+}, 'Basic ScrollTimeline creation should work'); |
+ |
+test(function() { |
+ const scrollTimeline = new ScrollTimeline( |
+ { timeRange: 100, orientation: 'block' }); |
+ |
+ assert_equals(scrollTimeline.scrollSource, document.scrollingElement); |
+}, 'If the scrollSource is unspecified, use the document scrollingElement'); |
+ |
+test(function() { |
+ const scroller = document.querySelector('.scroller'); |
+ const constructorFunc = function() { new ScrollTimeline( |
+ { scrollSource: scroller, orientation: 'nonsense', timeRange: 100 }) }; |
+ assert_throws(TypeError(), constructorFunc); |
+}, 'If the orientation is invalid, object construction should fail'); |
+ |
+// TODO(smcgruer): Remove once 'auto' timeRange is supported. |
+test(function() { |
+ const scroller = document.querySelector('.scroller'); |
+ const constructorFunc = function() { new ScrollTimeline( |
+ { scrollSource: scroller, orientation: 'block' }) }; |
+ assert_throws('NotSupportedError', constructorFunc); |
+}, 'If the timeRange is unspecified, object construction should fail'); |
+</script> |