OLD | NEW |
| (Empty) |
1 <!-- | |
2 Copyright 2013 Google Inc. All Rights Reserved. | |
3 | |
4 Licensed under the Apache License, Version 2.0 (the "License"); | |
5 you may not use this file except in compliance with the License. | |
6 You may obtain a copy of the License at | |
7 | |
8 http://www.apache.org/licenses/LICENSE-2.0 | |
9 | |
10 Unless required by applicable law or agreed to in writing, software | |
11 distributed under the License is distributed on an "AS IS" BASIS, | |
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
13 See the License for the specific language governing permissions and | |
14 limitations under the License. | |
15 --> | |
16 | |
17 <!DOCTYPE html><meta charset="UTF-8"> | |
18 <div id="anim"></div> | |
19 | |
20 <script src="../bootstrap.js"></script> | |
21 <script> | |
22 "use strict"; | |
23 | |
24 var anim = new Animation(document.getElementById("anim"), {left: "100px"}, | |
25 {iterations: 3.0}); | |
26 var animationGroup = new AnimationGroup(); | |
27 var animationSequence = new AnimationSequence(); | |
28 | |
29 // Should use intrinsic duration if Timing.duration is undefined. | |
30 // Animation | |
31 test(function() {assert_equals(anim.duration, 0.0)}, | |
32 "Animation duration should use intrinsic value"); | |
33 anim.timing.duration = 1.0; | |
34 test(function() {assert_equals(anim.duration, 1.0)}, | |
35 "Animation duration should use specified value"); | |
36 // AnimationGroup | |
37 test(function() {assert_equals(animationGroup.duration, 0.0)}, | |
38 "AnimationGroup duration should use intrinsic value"); | |
39 animationGroup.append(anim); | |
40 test(function() {assert_equals(animationGroup.duration, 3.0)}, | |
41 "AnimationGroup duration should be derived from child"); | |
42 animationGroup.timing.duration = 2.0; | |
43 test(function() {assert_equals(animationGroup.duration, 2.0)}, | |
44 "AnimationGroup duration should use specified value"); | |
45 // AnimationSequence | |
46 test(function() {assert_equals(animationSequence.duration, 0.0)}, | |
47 "AnimationSequence duration should use intrinsic value"); | |
48 animationSequence.append(anim); | |
49 test(function() {assert_equals(animationSequence.duration, 3.0)}, | |
50 "AnimationSequence duration should be derived from child"); | |
51 animationSequence.timing.duration = 4.0; | |
52 test(function() {assert_equals(animationSequence.duration, 4.0)}, | |
53 "AnimationSequence duration should use specified value"); | |
54 | |
55 test(function() { | |
56 assert_throws(new TypeError(), function() { | |
57 anim.duration = 5.0; | |
58 }); | |
59 assert_equals(anim.duration, 1.0); | |
60 }, "Animation.duration should be read-only"); | |
61 | |
62 anim.timing.duration = 14.0; | |
63 test(function() {assert_equals(anim.activeDuration, 42.0)}, | |
64 "activeDuration should always reflect TimedItem.duration"); | |
65 | |
66 </script> | |
OLD | NEW |