2 <script src=
"../../resources/testharness.js"></script>
3 <script src=
"../../resources/testharnessreport.js"></script>
4 <script src=
"resources/keyframes-test.js"></script>
6 var keyframeA
= {opacity
: '0.5', left
: '50px'};
7 var keyframeB
= {opacity
: '0', left
: '0px'};
8 var keyframeC
= {opacity
: '0.75', left
: '75px'};
10 var keyframeBExpectations
= {
11 0: {opacity
: '0.5', left
: '50px'},
12 0.25: {opacity
: '0.25', left
: '25px'},
13 0.5: {opacity
: '0', left
: '0px'}, // Corresponds to keyframeB (offset unspecified).
14 0.75: {opacity
: '0.375', left
: '37.5px'},
15 1: {opacity
: '0.75', left
: '75px'},
18 var offsetKeyframeA
= {opacity
: keyframeA
.opacity
, left
: keyframeA
.left
, offset
: 0};
19 var offsetKeyframeB
= {opacity
: keyframeB
.opacity
, left
: keyframeB
.left
, offset
: 0.25};
20 var offsetKeyframeC
= {opacity
: keyframeC
.opacity
, left
: keyframeC
.left
, offset
: 1};
22 var offsetKeyframeBExpectations
= {
23 0: {opacity
: '0.5', left
: '50px'},
24 0.125: {opacity
: '0.25', left
: '25px'},
25 0.25: {opacity
: '0', left
: '0px'}, // Corresponds to offsetKeyframeB (offset 0.25).
26 0.5: {opacity
: '0.25', left
: '25px'},
27 0.75: {opacity
: '0.5', left
: '50px'},
28 1: {opacity
: '0.75', left
: '75px'},
32 assertAnimationStyles([
36 ], keyframeBExpectations
, 'with first offset specified');
37 assertAnimationStyles([
41 ], offsetKeyframeBExpectations
, 'with second offset specified');
42 assertAnimationStyles([
46 ], keyframeBExpectations
, 'with third offset specified');
48 'element.animate() with 3 keyframes and 1 offset specified',
50 help
: 'http://dev.w3.org/fxtf/web-animations/#keyframe-animation-effects',
52 'element.animate() should start an animation when three keyframes',
53 'are provided with matching properties and one offset specified.',
54 'The keyframes must maintain their ordering and get distributed',
57 author
: 'Alan Cutter',
61 assertAnimationStyles([
65 ], offsetKeyframeBExpectations
, 'with first offset unspecified');
66 assertAnimationStyles([
70 ], keyframeBExpectations
, 'with second offset unspecified');
71 assertAnimationStyles([
75 ], offsetKeyframeBExpectations
, 'with third offset unspecified');
77 'element.animate() with 3 keyframes and 2 offsets specified',
79 help
: 'http://dev.w3.org/fxtf/web-animations/#keyframe-animation-effects',
81 'element.animate() should start an animation when three keyframes',
82 'are provided with matching properties and two offsets specified.',
83 'The keyframes must maintain their ordering and get distributed',
86 author
: 'Alan Cutter',
90 assertAnimationStyles([
94 ], offsetKeyframeBExpectations
, 'with ordered offsets');
95 assert_throws('InvalidModificationError', function() {
96 assertAnimationStyles([
100 ], offsetKeyframeBExpectations
, 'with unordered offsets (1)');
103 assert_throws('InvalidModificationError', function() {
104 assertAnimationStyles([
108 ], offsetKeyframeBExpectations
, 'with unordered offsets (2)');
111 assert_throws('InvalidModificationError', function() {
112 assertAnimationStyles([
116 ], offsetKeyframeBExpectations
, 'with unordered offsets (3)');
119 assert_throws('InvalidModificationError', function() {
120 assertAnimationStyles([
124 ], offsetKeyframeBExpectations
, 'with unordered offsets (4)');
127 assert_throws('InvalidModificationError', function() {
128 assertAnimationStyles([
132 ], offsetKeyframeBExpectations
, 'with unordered offsets (5)');
135 'element.animate() with 3 keyframes and 3 offsets specified',
137 help
: 'http://dev.w3.org/fxtf/web-animations/#keyframe-animation-effects',
139 'element.animate() should start an animation when three keyframes',
140 'are provided with matching properties and all offsets specified.',
141 'The keyframes must maintain their ordering and get distributed',
144 author
: 'Alan Cutter',