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 elem = document.getElementById("anim"); | |
25 var animFunc = {left: "100px"}; | |
26 | |
27 // Animation | |
28 var anim = new Animation(elem, animFunc, 1.0); | |
29 var clone = anim.clone(); | |
30 test(function() {assert_true(clone instanceof Animation)}, | |
31 "Clone should be an Animation"); | |
32 test(function() {assert_equals(clone.timing.duration, 1.0)}, | |
33 "Clone should take Timing.duration"); | |
34 test(function() {assert_equals(clone.target, elem)}, | |
35 "Clone should take target"); | |
36 | |
37 // AnimationGroup | |
38 var animationGroup = new AnimationGroup([anim, clone], 4.0); | |
39 var animationGroupClone = animationGroup.clone(); | |
40 test(function() {assert_true(animationGroupClone instanceof AnimationGroup, true
)}, | |
41 "AnimationGroup clone should be a AnimationGroup"); | |
42 test(function() {assert_equals(animationGroupClone.timing.duration, 4.0)}, | |
43 "AnimationGroup clone should take Timing.duration"); | |
44 test(function() {assert_equals(animationGroupClone.children.length, 2)}, | |
45 "AnimationGroup clone should clone children"); | |
46 test(function() {assert_not_equals(animationGroupClone.children[0], anim)}, | |
47 "AnimationGroup clone should clone first child"); | |
48 test(function() {assert_equals(animationGroupClone.children[0].duration, 1.0)}, | |
49 "AnimationGroup clone should clone first child's duration"); | |
50 test(function() {assert_not_equals(animationGroupClone.children[1], clone)}, | |
51 "AnimationGroup clone should clone second child"); | |
52 test(function() {assert_equals(animationGroupClone.children[1].duration, 1.0)}, | |
53 "AnimationGroup clone should clone second child's duration"); | |
54 | |
55 // AnimationSequence | |
56 var animationSequence = new AnimationSequence([anim, clone], 6.0); | |
57 var animationSequenceClone = animationSequence.clone(); | |
58 test(function() {assert_true(animationSequenceClone instanceof AnimationSequence
)}, | |
59 "AnimationSequence clone should be a AnimationSequence"); | |
60 test(function() {assert_equals(animationSequenceClone.timing.duration, 6.0)}, | |
61 "AnimationSequence clone should take Timing.duration"); | |
62 test(function() {assert_equals(animationSequenceClone.children.length, 2)}, | |
63 "AnimationSequence clone should clone children"); | |
64 test(function() {assert_not_equals(animationSequenceClone.children[0], anim)}, | |
65 "AnimationSequence clone should clone first child"); | |
66 test(function() {assert_equals(animationSequenceClone.children[0].duration, 1.0)
}, | |
67 "AnimationSequence clone should clone first child's duration"); | |
68 test(function() {assert_not_equals(animationSequenceClone.children[1], clone)}, | |
69 "AnimationSequence clone should clone second child"); | |
70 test(function() {assert_equals(animationSequenceClone.children[1].duration, 1.0)
}, | |
71 "AnimationSequence clone should clone second child's duration"); | |
72 | |
73 // Child | |
74 var childClone = anim.clone(); | |
75 test(function() {assert_equals(anim.parent, animationSequence)}, | |
76 "Child clone should not equal animationSequence"); | |
77 test(function() {assert_equals(childClone.parent, null)}, | |
78 "Child clone should not take parent"); | |
79 | |
80 </script> | |
OLD | NEW |