blob: d006c86b6d312d85cb60cba8d2da8dd4198c122f [file] [log] [blame]
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<div id="cssTarget"></div>
<svg>
<rect id="svgTarget" color="red"></rect>
</svg>
<script>
internals.disableCSSAdditiveAnimations();
test(() => {
assert_throws('NotSupportedError', () => {
cssTarget.animate({color: 'red'});
});
assert_throws('NotSupportedError', () => {
cssTarget.animate([
{color: 'red'},
{color: 'red', composite: 'add'},
]);
});
}, 'Precheck that disabling CSS additive animations works.');
test(() => {
var animation = svgTarget.animate({'svg-color': 'green'}, 1);
animation.pause();
animation.currentTime = 0.5;
assert_equals(getComputedStyle(svgTarget).color, 'rgb(128, 64, 0)');
animation.cancel();
}, 'Neutral keyframes supported for SVG presentation attributes.');
test(() => {
var keyframe = {'svg-color': 'green', composite: 'add'};
var animation = svgTarget.animate([keyframe, keyframe], {fill: 'forwards'});
assert_equals(getComputedStyle(svgTarget).color, 'rgb(255, 128, 0)');
animation.cancel();
}, 'Additive keyframes supported for SVG presentation attributes.');
</script>