composite.html (1625B)
1 <!doctype html> 2 <meta charset=utf-8> 3 <title>KeyframeEffect.composite</title> 4 <link rel="help" 5 href="https://drafts.csswg.org/web-animations/#dom-keyframeeffect-composite"> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="../../testcommon.js"></script> 9 <body> 10 <div id="log"></div> 11 <script> 12 'use strict'; 13 14 test(t => { 15 const anim = createDiv(t).animate(null); 16 assert_equals(anim.effect.composite, 'replace', 17 'The default value should be replace'); 18 }, 'Default value'); 19 20 test(t => { 21 const anim = createDiv(t).animate(null); 22 anim.effect.composite = 'add'; 23 assert_equals(anim.effect.composite, 'add', 24 'The effect composite value should be replaced'); 25 }, 'Change composite value'); 26 27 test(t => { 28 const anim = createDiv(t).animate({ left: '10px' }); 29 30 anim.effect.composite = 'add'; 31 const keyframes = anim.effect.getKeyframes(); 32 assert_equals(keyframes[0].composite, 'auto', 33 'unspecified keyframe composite value should be auto even ' + 34 'if effect composite is set'); 35 }, 'Unspecified keyframe composite value when setting effect composite'); 36 37 test(t => { 38 const anim = createDiv(t).animate({ left: '10px', composite: 'replace' }); 39 40 anim.effect.composite = 'add'; 41 const keyframes = anim.effect.getKeyframes(); 42 assert_equals(keyframes[0].composite, 'replace', 43 'specified keyframe composite value should not be overridden ' + 44 'by setting effect composite'); 45 }, 'Specified keyframe composite value when setting effect composite'); 46 47 </script>