2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
11 background-color: black;
16 <div id='e1' class='anim'></div>
17 <div id='e2' class='anim'></div>
18 <div id='e3' class='anim'></div>
22 var e1 = document.getElementById('e1');
23 var e2 = document.getElementById('e2');
24 var e3 = document.getElementById('e3');
26 var e1Style = getComputedStyle(e1);
27 var e2Style = getComputedStyle(e2);
28 var e3Style = getComputedStyle(e3);
30 var durationValue = 1;
34 {left: '10px', opacity: '1', offset: 0},
35 {left: '100px', opacity: '0', offset: 1}
37 internals.pauseAnimations(durationValue / 2);
38 assert_equals(e1Style.left, '55px');
39 assert_equals(e1Style.opacity, '0.5');
40 }, 'Calling animate() should start an animation.');
44 {backgroundColor: 'green', offset: 0},
45 {backgroundColor: 'purple', offset: 1}
47 internals.pauseAnimations(durationValue / 2);
48 assert_equals(e2Style.backgroundColor, 'rgb(64, 64, 64)');
49 }, 'Calling animate() should start an animation. CamelCase property names should be parsed.');
51 var keyframesWithInvalid = [
53 {width: '0px', backgroundColor: 'octarine', offset: 0.2},
54 {width: '1000px', foo: 'bar', offset: 1}
58 e3.animate(keyframesWithInvalid, {duration: durationValue, fill: 'forwards'});
59 internals.pauseAnimations(durationValue);
60 assert_equals(e3Style.width, '1000px');
61 assert_equals(e3Style.backgroundColor, 'rgb(0, 0, 0)');
62 assert_equals(e3Style.foo, undefined);
63 }, 'Calling animate() with a pre-constructed keyframes list should start an animation. Invalid style declarations should be ignored.');