| <!DOCTYPE html> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| <style> |
| #target { |
| --has-value: 100; |
| --fallback-value: 200; |
| } |
| </style> |
| <div id="target"></div> |
| <script> |
| setup(() => { |
| for (let name of ['--test', '--has-value']) { |
| CSS.registerProperty({ |
| name, |
| syntax: '<number>', |
| initialValue: '0', |
| inherits: false, |
| }); |
| } |
| }); |
| |
| test(() => { |
| let animation = target.animate({ |
| '--test': [ |
| 'var(--has-value)', |
| 'var(--has-no-value, var(--fallback-value))', |
| ], |
| }, 100); |
| |
| animation.currentTime = 25; |
| assert_equals(getComputedStyle(target).getPropertyValue('--test'), '125', 'target at 25%'); |
| |
| animation.currentTime = 75; |
| assert_equals(getComputedStyle(target).getPropertyValue('--test'), '175', 'target at 75%'); |
| }, 'Animated registered custom properties will use var() fallback values when the referenced custom property has no value.'); |
| </script> |