OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <meta charset=utf-8> | 2 <meta charset=utf-8> |
3 <title>Keyframe handling tests</title> | 3 <title>Keyframe handling tests</title> |
4 <link rel="help" href="https://w3c.github.io/web-animations/#the-effect-value-of
-a-keyframe-animation-effect"> | 4 <link rel="help" href="https://w3c.github.io/web-animations/#the-effect-value-of
-a-keyframe-animation-effect"> |
5 <link rel="author" title="Brian Birtles" href="mailto:bbirtles@mozilla.com"> | 5 <link rel="author" title="Brian Birtles" href="mailto:bbirtles@mozilla.com"> |
6 <script src="../../../../resources/testharness.js"></script> | 6 <script src="../../../../resources/testharness.js"></script> |
7 <script src="../../../../resources/testharnessreport.js"></script> | 7 <script src="../../../../resources/testharnessreport.js"></script> |
8 <script src="../testcommon.js"></script> | 8 <script src="../testcommon.js"></script> |
9 <body> | 9 <body> |
10 <div id="log"></div> | 10 <div id="log"></div> |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 assert_equals(getComputedStyle(div).opacity, '0.7', | 63 assert_equals(getComputedStyle(div).opacity, '0.7', |
64 'At the overlap point, the last keyframe from the' | 64 'At the overlap point, the last keyframe from the' |
65 + ' overlap point should be used as interval startpoint'); | 65 + ' overlap point should be used as interval startpoint'); |
66 anim.currentTime = 750; | 66 anim.currentTime = 750; |
67 assert_equals(getComputedStyle(div).opacity, '0.85', | 67 assert_equals(getComputedStyle(div).opacity, '0.85', |
68 'After the overlap point, the last keyframe from the' | 68 'After the overlap point, the last keyframe from the' |
69 + ' overlap point should be used as interval startpoint'); | 69 + ' overlap point should be used as interval startpoint'); |
70 }, 'Overlapping keyframes between 0 and 1 use the appropriate value on each' | 70 }, 'Overlapping keyframes between 0 and 1 use the appropriate value on each' |
71 + ' side of the overlap point'); | 71 + ' side of the overlap point'); |
72 | 72 |
| 73 test(function(t) { |
| 74 var div = createDiv(t); |
| 75 var anim = div.animate({ visibility: ['hidden','visible'] }, |
| 76 { duration: 100 * MS_PER_SEC, fill: 'both' }); |
| 77 |
| 78 anim.currentTime = 0; |
| 79 assert_equals(getComputedStyle(div).visibility, 'hidden', |
| 80 'Visibility when progress = 0.'); |
| 81 |
| 82 anim.currentTime = 10 * MS_PER_SEC + 1; |
| 83 assert_equals(getComputedStyle(div).visibility, 'visible', |
| 84 'Visibility when progress > 0 due to linear easing.'); |
| 85 |
| 86 anim.finish(); |
| 87 assert_equals(getComputedStyle(div).visibility, 'visible', |
| 88 'Visibility when progress = 1.'); |
| 89 |
| 90 }, "Test visibility clamping behavior."); |
| 91 |
| 92 test(function(t) { |
| 93 var div = createDiv(t); |
| 94 var anim = div.animate({ visibility: ['hidden', 'visible'] }, |
| 95 { duration: 100 * MS_PER_SEC, fill: 'both', |
| 96 easing: 'cubic-bezier(0.25, -0.6, 0, 0.5)' }); |
| 97 |
| 98 anim.currentTime = 0; |
| 99 assert_equals(getComputedStyle(div).visibility, 'hidden', |
| 100 'Visibility when progress = 0.'); |
| 101 |
| 102 // Timing function is below zero. So we expected visibility is hidden. |
| 103 anim.currentTime = 10 * MS_PER_SEC + 1; |
| 104 assert_equals(getComputedStyle(div).visibility, 'hidden', |
| 105 'Visibility when progress < 0 due to cubic-bezier easing.'); |
| 106 |
| 107 anim.currentTime = 60 * MS_PER_SEC; |
| 108 assert_equals(getComputedStyle(div).visibility, 'visible', |
| 109 'Visibility when progress > 0 due to cubic-bezier easing.'); |
| 110 |
| 111 }, "Test visibility clamping behavior with an easing that has a negative compone
nt"); |
| 112 |
73 done(); | 113 done(); |
74 </script> | 114 </script> |
75 </body> | 115 </body> |
OLD | NEW |