animation-computed.html (2083B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>CSS Animations: getComputedStyle().animation</title> 6 <link rel="help" href="https://drafts.csswg.org/css-animations/#propdef-animation"> 7 <meta name="assert" content="animation computed value is as specified."> 8 <script src="/resources/testharness.js"></script> 9 <script src="/resources/testharnessreport.js"></script> 10 <script src="/css/support/computed-testcommon.js"></script> 11 </head> 12 <body> 13 <div id="target"></div> 14 <script> 15 // <single-animation> = <time> || <easing-function> || <time> || 16 // <single-animation-iteration-count> || <single-animation-direction> || 17 // <single-animation-fill-mode> || <single-animation-play-state> || 18 // [ none | <keyframes-name> ] 19 20 test(() => { 21 assert_equals(getComputedStyle(document.getElementById('target')).animation, "none"); 22 }, "Default animation value"); 23 24 test_computed_value("animation", "1s", "1s"); 25 test_computed_value("animation", "cubic-bezier(0, -2, 1, 3)", "cubic-bezier(0, -2, 1, 3)"); 26 test_computed_value("animation", "ease-in-out", "ease-in-out"); 27 test_computed_value("animation", "1s -3s", "1s -3s"); 28 test_computed_value("animation", "4", "4"); 29 test_computed_value("animation", "reverse", "reverse"); 30 test_computed_value("animation", "both", "both"); 31 test_computed_value("animation", "paused", "paused"); 32 test_computed_value("animation", "none", "none"); 33 test_computed_value("animation", "anim", "anim"); 34 35 test_computed_value("animation", "anim paused both reverse 4 1s -3s cubic-bezier(0, -2, 1, 3)", 36 "1s cubic-bezier(0, -2, 1, 3) -3s 4 reverse both paused anim"); 37 38 test_computed_value("animation", "anim paused both reverse, 4 1s -3s cubic-bezier(0, -2, 1, 3)", 39 "reverse both paused anim, 1s cubic-bezier(0, -2, 1, 3) -3s 4"); 40 41 test_computed_value("animation", "none, none", "none, none"); 42 43 test(() => { 44 const target = document.getElementById('target'); 45 target.style.animation = "initial"; 46 target.style.animationDelay = "1s"; 47 assert_equals(getComputedStyle(target).animation, "0s 1s"); 48 }, "Animation with a delay but no duration"); 49 50 </script> 51 </body> 52 </html>