2 <script src=
"../resources/testharness.js"></script>
3 <script src=
"../resources/testharnessreport.js"></script>
10 var element
= document
.getElementById('e');
11 var keyframes
= [{opacity
: '1', offset
: 0}, {opacity
: '0', offset
: 1}];
13 var keyframeEffectBasic
= new KeyframeEffect(element
, keyframes
);
14 var specifiedTimingBasic
= keyframeEffectBasic
.timing
;
16 var timingNumberDuration
= {duration
: 2};
17 var animationNumberDuration
= new KeyframeEffect(element
, keyframes
, timingNumberDuration
);
18 var specifiedTimingNumberDuration
= animationNumberDuration
.timing
;
20 var timingNoDuration
= {iterations
: 3};
21 var animationNoDuration
= new KeyframeEffect(element
, keyframes
, timingNoDuration
);
22 var specifiedTimingNoDuration
= animationNoDuration
.timing
;
24 var timingAllFields
= {
35 var animationAllFields
= new KeyframeEffect(element
, keyframes
, timingAllFields
);
36 var specifiedTimingAllFields
= animationAllFields
.timing
;
39 assert_equals(specifiedTimingBasic
.constructor, AnimationEffectTiming
);
40 assert_equals(specifiedTimingBasic
.delay
, 0);
41 assert_equals(specifiedTimingBasic
.endDelay
, 0);
42 assert_equals(specifiedTimingBasic
.fill
, 'auto');
43 assert_equals(specifiedTimingBasic
.iterationStart
, 0);
44 assert_equals(specifiedTimingBasic
.iterations
, 1);
45 assert_equals(specifiedTimingBasic
.duration
, 'auto');
46 assert_equals(specifiedTimingBasic
.playbackRate
, 1);
47 assert_equals(specifiedTimingBasic
.direction
, 'normal');
48 assert_equals(specifiedTimingBasic
.easing
, 'linear');
49 }, 'TimedItem.timing should return a TimedItemTiming, which should have a getter for each member of the underlying Timing object.');
52 assert_equals(specifiedTimingNumberDuration
.duration
, 2);
53 }, 'TimedItem.timing.duration should return a number when duration was set as a number.');
56 assert_equals(specifiedTimingNoDuration
.duration
, 'auto');
57 }, 'TimedItem.timing.duration should return "auto" when duration was not specified.');
60 assert_equals(specifiedTimingAllFields
.delay
, 2);
61 assert_equals(specifiedTimingAllFields
.endDelay
, 0.5);
62 assert_equals(specifiedTimingAllFields
.fill
, 'backwards');
63 assert_equals(specifiedTimingAllFields
.iterationStart
, 2);
64 assert_equals(specifiedTimingAllFields
.iterations
, 10);
65 assert_equals(specifiedTimingAllFields
.duration
, 5);
66 assert_equals(specifiedTimingAllFields
.playbackRate
, 2);
67 assert_equals(specifiedTimingAllFields
.direction
, 'reverse');
68 assert_equals(specifiedTimingAllFields
.easing
, 'step-start');
69 }, 'TimedItem.timing should have a getter for each member of the underlying Timing object.');