Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / web-animations-api / non-animatable-property.html
1 <!DOCTYPE html>
2 <script src="../resources/testharness.js"></script>
3 <script src="../resources/testharnessreport.js"></script>
4
5 <div id='e'></div>
6
7 <script>
8 var player;
9
10 function expectValue(time, property, expectation) {
11   player.currentTime = time;
12   assert_equals(getComputedStyle(e)[property], expectation);
13 }
14
15 test(function() {
16   player = e.animate(
17       [{float: 'left'}, {float: 'right'}],
18       {duration: 1, fill: 'both'});
19   player.pause();
20
21   expectValue(0, 'float', 'left');
22   expectValue(0.25, 'float', 'left');
23   expectValue(0.49, 'float', 'left');
24   expectValue(0.5, 'float', 'right');
25   expectValue(0.75, 'float', 'right');
26   expectValue(1, 'float', 'right');
27 }, 'Non-animatable property float should 50% flip between keyframe values via the element.animate() API.');
28
29 test(function() {
30   player = e.animate([
31       {animationName: 'a', animationDuration: '1s', transitionProperty: 'left', transitionDuration: '1s', display: 'table'},
32       {animationName: 'b', animationDuration: '10s', transitionProperty: 'right', transitionDuration: '10s', display: 'none'},
33     ], {duration: 1, fill: 'both'});
34   player.pause();
35
36   expectValue(0, 'animationName', 'none');
37   expectValue(0.25, 'animationName', 'none');
38   expectValue(0.5, 'animationName', 'none');
39   expectValue(0.75, 'animationName', 'none');
40   expectValue(1, 'animationName', 'none');
41
42   expectValue(0, 'animationDuration', '0s');
43   expectValue(0.25, 'animationDuration', '0s');
44   expectValue(0.5, 'animationDuration', '0s');
45   expectValue(0.75, 'animationDuration', '0s');
46   expectValue(1, 'animationDuration', '0s');
47
48   expectValue(0, 'transitionProperty', 'all');
49   expectValue(0.25, 'transitionProperty', 'all');
50   expectValue(0.5, 'transitionProperty', 'all');
51   expectValue(0.75, 'transitionProperty', 'all');
52   expectValue(1, 'transitionProperty', 'all');
53
54   expectValue(0, 'transitionDuration', '0s');
55   expectValue(0.25, 'transitionDuration', '0s');
56   expectValue(0.5, 'transitionDuration', '0s');
57   expectValue(0.75, 'transitionDuration', '0s');
58   expectValue(1, 'transitionDuration', '0s');
59
60   expectValue(0, 'display', 'block');
61   expectValue(0.25, 'display', 'block');
62   expectValue(0.5, 'display', 'block');
63   expectValue(0.75, 'display', 'block');
64   expectValue(1, 'display', 'block');
65 }, 'Animation related properties should not be animatable via element.animate().');
66 </script>