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 animationGroup = new AnimationGroup(); | |
25 var anim = new Animation(document.getElementById("anim"), {left: "100px"}, | |
26 {iterations: 3.0}); | |
27 var anim1 = new Animation(document.getElementById("anim"), {top: "100px"}, | |
28 {iterations: 3.0}); | |
29 var anim2 = new Animation(document.getElementById("anim"), {width: "100px"}, | |
30 {iterations: 3.0}); | |
31 var anim3 = new Animation(document.getElementById("anim"), {height: "100px"}, | |
32 {iterations: 3.0}); | |
33 | |
34 test(function() {assert_equals(anim.previousSibling, null)}, | |
35 "Single animation should have no previous sibling"); | |
36 | |
37 test(function() {assert_equals(anim.nextSibling, null)}, | |
38 "Single animation should have no next sibling"); | |
39 | |
40 animationGroup.append(anim); | |
41 | |
42 test(function() {assert_equals(anim.previousSibling, null)}, | |
43 "Single animation in a animationGroup should have no previous sibling"); | |
44 | |
45 test(function() {assert_equals(anim.nextSibling, null)}, | |
46 "Single animation in a animationGroup should have no next sibling"); | |
47 | |
48 animationGroup.prepend(anim1); | |
49 | |
50 test(function() {assert_equals(anim.previousSibling, anim1)}, | |
51 "Animation should have a previous sibling when there is one"); | |
52 | |
53 test(function() {assert_equals(anim.nextSibling, null)}, | |
54 "Animation should have no next sibling when there is none"); | |
55 | |
56 animationGroup.append(anim2); | |
57 | |
58 test(function() {assert_equals(anim.previousSibling, anim1)}, | |
59 "Animation should have a previous sibling when there is one"); | |
60 | |
61 test(function() {assert_equals(anim.nextSibling, anim2)}, | |
62 "Animation should have a next sibling when there is one"); | |
63 | |
64 animationGroup.prepend(anim3); | |
65 | |
66 test(function() {assert_equals(anim.previousSibling, anim1)}, | |
67 "Animation should have the correct previous sibling when there is more than
one"); | |
68 | |
69 test(function() {assert_equals(anim.nextSibling, anim2)}, | |
70 "Animation should have a next sibling when there is one"); | |
71 anim1.remove(); | |
72 | |
73 test(function() {assert_equals(anim.previousSibling, anim3)}, | |
74 "Animation should have the correct previous sibling when the old one is rem
oved"); | |
75 | |
76 test(function() {assert_equals(anim.nextSibling, anim2)}, | |
77 "Animation should have a next sibling when there is one"); | |
78 | |
79 anim3.remove(); | |
80 animationGroup.append(anim3); | |
81 | |
82 test(function() {assert_equals(anim.previousSibling, null)}, | |
83 "Animation should have the no previous sibling when there is none"); | |
84 | |
85 test(function() {assert_equals(anim.nextSibling, anim2)}, | |
86 "Animation should have a next sibling when there is more than one"); | |
87 | |
88 anim2.remove(); | |
89 | |
90 test(function() {assert_equals(anim.previousSibling, null)}, | |
91 "Animation should have the no previous sibling when there is none"); | |
92 | |
93 test(function() {assert_equals(anim.nextSibling, anim3)}, | |
94 "Animation should have the correct next sibling when the old one is removed
"); | |
95 | |
96 anim.before(anim1); | |
97 | |
98 test(function() {assert_equals(anim.previousSibling, anim1)}, | |
99 "Animation should have the correct previous sibling when one is added"); | |
100 | |
101 test(function() {assert_equals(anim.nextSibling, anim3)}, | |
102 "Animation should have the correct next sibling when the old one is removed
"); | |
103 | |
104 anim.after(anim2); | |
105 | |
106 test(function() {assert_equals(anim.previousSibling, anim1)}, | |
107 "Animation should have a previous sibling when there is one"); | |
108 | |
109 test(function() {assert_equals(anim.nextSibling, anim2)}, | |
110 "Animation should have the correct next sibling when a new one is added"); | |
111 | |
112 </script> | |
OLD | NEW |