| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <style> |
| 5 #target { |
| 6 transition-property: --transition; |
| 7 transition-duration: 1s; |
| 8 transition-delay: -0.5s; |
| 9 transition-timing-function: linear; |
| 10 --transition: 100; |
| 11 } |
| 12 </style> |
| 13 <div id="target">target</div> |
| 14 <script> |
| 15 for (let name of ['--transition', '--test']) { |
| 16 CSS.registerProperty({ |
| 17 name, |
| 18 syntax: '<number>', |
| 19 initialValue: '0', |
| 20 }); |
| 21 } |
| 22 |
| 23 test(() => { |
| 24 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '0', '--tes
t at initial value'); |
| 25 assert_equals(getComputedStyle(target).getPropertyValue('--transition'), '100'
, '--transition at initial value'); |
| 26 |
| 27 let animation = target.animate({'--test': ['50', 'var(--transition)']}, {durat
ion: 100, fill: 'forwards'}); |
| 28 |
| 29 animation.currentTime = 0; |
| 30 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '50', '--te
st at 0% with no transition'); |
| 31 animation.currentTime = 50; |
| 32 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '75', '--te
st at 50% with no transition'); |
| 33 animation.currentTime = 100; |
| 34 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '100', '--t
est at 100% with no transition'); |
| 35 |
| 36 target.style.setProperty('--transition', '200'); |
| 37 assert_equals(getComputedStyle(target).getPropertyValue('--transition'), '150'
, '--transition at initial transitioning value'); |
| 38 |
| 39 animation.currentTime = 0; |
| 40 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '50', '--te
st at 0% with transition'); |
| 41 animation.currentTime = 50; |
| 42 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '100', '--t
est at 50% with transition'); |
| 43 animation.currentTime = 100; |
| 44 assert_equals(getComputedStyle(target).getPropertyValue('--test'), '150', '--t
est at 50% with transition'); |
| 45 }, 'Registered custom property animation keyframes with var() references to anim
ating unregistered custom properties'); |
| 46 </script> |
| OLD | NEW |