OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <style> | |
3 .scroller { | |
4 height: 100px; | |
5 width: 100px; | |
6 overflow: auto; | |
majidvp
2017/06/28 15:52:38
nit: In this case this it always overflows so it i
smcgruer
2017/06/29 15:23:22
Done.
| |
7 } | |
8 | |
9 .content { | |
10 height: 500px; | |
11 width: 500px; | |
12 } | |
13 </style> | |
14 | |
15 <div class='scroller'> | |
16 <div class='content'></div> | |
17 </div> | |
18 | |
19 <script src='../../../resources/testharness.js'></script> | |
20 <script src='../../../resources/testharnessreport.js'></script> | |
21 <script> | |
22 test(function() { | |
23 const scroller = document.querySelector('.scroller'); | |
24 const scrollTimeline = new ScrollTimeline( | |
25 { scrollSource: scroller, timeRange: 100, orientation: 'inline' }); | |
26 | |
27 assert_equals(scrollTimeline.scrollSource, scroller); | |
28 assert_equals(scrollTimeline.timeRange, 100); | |
29 assert_equals(scrollTimeline.orientation, 'inline'); | |
30 }, 'Basic ScrollTimeline creation should work'); | |
31 | |
32 test(function() { | |
33 const scrollTimeline = new ScrollTimeline( | |
34 { timeRange: 100, orientation: 'block' }); | |
35 | |
36 assert_equals(scrollTimeline.scrollSource, document.scrollingElement); | |
37 }, 'If the scrollSource is unspecified, use the document scrollingElement'); | |
38 | |
39 test(function() { | |
40 const scroller = document.querySelector('.scroller'); | |
41 const constructorFunc = function() { new ScrollTimeline( | |
42 { scrollSource: scroller, orientation: 'nonsense', timeRange: 100 }) }; | |
43 assert_throws(TypeError(), constructorFunc); | |
44 }, 'If the orientation is invalid, object construction should fail'); | |
45 | |
46 // TODO(smcgruer): Remove once 'auto' timeRange is supported. | |
47 test(function() { | |
48 const scroller = document.querySelector('.scroller'); | |
49 const constructorFunc = function() { new ScrollTimeline( | |
50 { scrollSource: scroller, orientation: 'block' }) }; | |
51 assert_throws('NotSupportedError', constructorFunc); | |
52 }, 'If the timeRange is unspecified, object construction should fail'); | |
53 </script> | |
OLD | NEW |