OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>AnimationEffectTiming easing tests</title> | 3 <title>AnimationEffectTiming easing tests</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#the-animationeffect
timing-interface"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#the-animationeffect
timing-interface"> |
5 <script src="../resources/testharness.js"></script> | 5 <script src="../resources/testharness.js"></script> |
6 <script src="../resources/testharnessreport.js"></script> | 6 <script src="../resources/testharnessreport.js"></script> |
7 <script> | 7 <script> |
8 var animate_with_easing = function(inputEasing) { | 8 var animate_with_easing = function(inputEasing) { |
9 return document.documentElement.animate([], { easing : inputEasing }); | 9 return document.documentElement.animate([], { easing : inputEasing }); |
10 }; | 10 }; |
(...skipping 13 matching lines...) Expand all Loading... |
24 function() { animate_with_easing(inputEasing); }, | 24 function() { animate_with_easing(inputEasing); }, |
25 'with inputEasing=\'' + inputEasing + '\''); | 25 'with inputEasing=\'' + inputEasing + '\''); |
26 }; | 26 }; |
27 | 27 |
28 test(function() { | 28 test(function() { |
29 assert_animate_with_easing_roundtrips('ease'); | 29 assert_animate_with_easing_roundtrips('ease'); |
30 assert_animate_with_easing_roundtrips('linear'); | 30 assert_animate_with_easing_roundtrips('linear'); |
31 assert_animate_with_easing_roundtrips('ease-in'); | 31 assert_animate_with_easing_roundtrips('ease-in'); |
32 assert_animate_with_easing_roundtrips('ease-out'); | 32 assert_animate_with_easing_roundtrips('ease-out'); |
33 assert_animate_with_easing_roundtrips('ease-in-out'); | 33 assert_animate_with_easing_roundtrips('ease-in-out'); |
34 assert_animate_with_easing_roundtrips('step-start'); | |
35 assert_animate_with_easing_roundtrips('step-middle'); | |
36 assert_animate_with_easing_roundtrips('step-end'); | |
37 assert_animate_with_easing_roundtrips('steps(3, start)'); | |
38 assert_animate_with_easing_roundtrips('steps(3, middle)'); | |
39 assert_animate_with_easing_roundtrips('steps(3, end)'); | |
40 assert_animate_with_easing_roundtrips('cubic-bezier(0.1, 5, 0.23, 0)'); | 34 assert_animate_with_easing_roundtrips('cubic-bezier(0.1, 5, 0.23, 0)'); |
41 }, 'Valid easing functions should come out the same as they went in'); | 35 }, 'Valid linear and cubic-bezier easing functions should come out the same as t
hey went in'); |
42 | 36 |
43 test(function() { | 37 test(function() { |
44 assert_animate_with_easing_succeeds('steps(3)', 'steps(3, end)'); | 38 assert_animate_with_easing_succeeds('step-start', 'steps(1, start)'); |
45 }, 'steps easing second parameter defaults to end'); | 39 assert_animate_with_easing_succeeds('step-middle', 'steps(1, middle)'); |
| 40 assert_animate_with_easing_succeeds('step-end', 'steps(1)'); |
| 41 assert_animate_with_easing_succeeds('steps(3, start)', 'steps(3, start)'); |
| 42 assert_animate_with_easing_succeeds('steps(3, middle)', 'steps(3, middle)'); |
| 43 assert_animate_with_easing_succeeds('steps(3, end)', 'steps(3)'); |
| 44 assert_animate_with_easing_succeeds('steps(3)', 'steps(3)'); |
| 45 }, 'Valid step-function easings serialize as steps(<int>) or steps(<int>, start)
'); |
46 | 46 |
47 test(function() { | 47 test(function() { |
48 assert_animate_with_easing_succeeds('eAse\\2d iN-ouT', 'ease-in-out'); | 48 assert_animate_with_easing_succeeds('eAse\\2d iN-ouT', 'ease-in-out'); |
49 }, 'Should accept arbitrary casing and escape chararcters'); | 49 }, 'Should accept arbitrary casing and escape chararcters'); |
50 | 50 |
51 test(function() { | 51 test(function() { |
52 assert_animate_with_easing_throws(''); | 52 assert_animate_with_easing_throws(''); |
53 assert_animate_with_easing_throws('initial'); | 53 assert_animate_with_easing_throws('initial'); |
54 assert_animate_with_easing_throws('inherit'); | 54 assert_animate_with_easing_throws('inherit'); |
55 assert_animate_with_easing_throws('unset'); | 55 assert_animate_with_easing_throws('unset'); |
56 assert_animate_with_easing_throws('steps(3, nowhere)'); | 56 assert_animate_with_easing_throws('steps(3, nowhere)'); |
57 assert_animate_with_easing_throws('steps(-3, end)'); | 57 assert_animate_with_easing_throws('steps(-3, end)'); |
58 assert_animate_with_easing_throws('cubic-bezier(0.1, 0, 4, 0.4)'); | 58 assert_animate_with_easing_throws('cubic-bezier(0.1, 0, 4, 0.4)'); |
59 assert_animate_with_easing_throws('function (a){return a}'); | 59 assert_animate_with_easing_throws('function (a){return a}'); |
60 assert_animate_with_easing_throws('function (x){return x}'); | 60 assert_animate_with_easing_throws('function (x){return x}'); |
61 assert_animate_with_easing_throws('function(x, y){return 0.3}'); | 61 assert_animate_with_easing_throws('function(x, y){return 0.3}'); |
62 assert_animate_with_easing_throws('7'); | 62 assert_animate_with_easing_throws('7'); |
63 }, 'Invalid easing values should throw a TypeError'); | 63 }, 'Invalid easing values should throw a TypeError'); |
64 </script> | 64 </script> |
OLD | NEW |