OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>Effect value computation tests for 'visibility' property</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#the-effect-value-of
-a-keyframe-animation-effect"> |
| 5 <script src="/resources/testharness.js"></script> |
| 6 <script src="/resources/testharnessreport.js"></script> |
| 7 <script src="../../testcommon.js"></script> |
| 8 <body> |
| 9 <div id="log"></div> |
| 10 <div id="target"></div> |
| 11 <script> |
| 12 'use strict'; |
| 13 |
| 14 test(function(t) { |
| 15 var div = createDiv(t); |
| 16 var anim = div.animate({ visibility: ['hidden','visible'] }, |
| 17 { duration: 100 * MS_PER_SEC, fill: 'both' }); |
| 18 |
| 19 anim.currentTime = 0; |
| 20 assert_equals(getComputedStyle(div).visibility, 'hidden', |
| 21 'Visibility when progress = 0'); |
| 22 |
| 23 anim.currentTime = 10 * MS_PER_SEC + 1; |
| 24 assert_equals(getComputedStyle(div).visibility, 'visible', |
| 25 'Visibility when progress > 0 due to linear easing'); |
| 26 |
| 27 anim.finish(); |
| 28 assert_equals(getComputedStyle(div).visibility, 'visible', |
| 29 'Visibility when progress = 1'); |
| 30 |
| 31 }, 'Visibility clamping behavior'); |
| 32 |
| 33 test(function(t) { |
| 34 var div = createDiv(t); |
| 35 var anim = div.animate({ visibility: ['hidden', 'visible'] }, |
| 36 { duration: 100 * MS_PER_SEC, fill: 'both', |
| 37 easing: 'cubic-bezier(0.25, -0.6, 0, 0.5)' }); |
| 38 |
| 39 anim.currentTime = 0; |
| 40 assert_equals(getComputedStyle(div).visibility, 'hidden', |
| 41 'Visibility when progress = 0'); |
| 42 |
| 43 // Timing function is below zero. So we expected visibility is hidden. |
| 44 anim.currentTime = 10 * MS_PER_SEC + 1; |
| 45 assert_equals(getComputedStyle(div).visibility, 'hidden', |
| 46 'Visibility when progress < 0 due to cubic-bezier easing'); |
| 47 |
| 48 anim.currentTime = 60 * MS_PER_SEC; |
| 49 assert_equals(getComputedStyle(div).visibility, 'visible', |
| 50 'Visibility when progress > 0 due to cubic-bezier easing'); |
| 51 |
| 52 }, 'Visibility clamping behavior with an easing that has a negative component'); |
| 53 |
| 54 </script> |
| 55 </body> |
OLD | NEW |