OLD | NEW |
| (Empty) |
1 <!DOCTYPE html> | |
2 <meta charset=utf-8> | |
3 <title>AnimationNode nextSibling attribute tests</title> | |
4 <meta name="assert" content="The next sibling of this animation node"> | |
5 <link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-ne
xtsibling"> | |
6 <link rel="help" href="http://www.w3.org/TR/dom/#concept-tree-next-sibling"> | |
7 <link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru"> | |
8 <link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru"
> | |
9 <script src="../../../../resources/testharness.js"></script> | |
10 <script src="../../../../resources/testharnessreport.js"></script> | |
11 <script src="../testcommon.js"></script> | |
12 <body> | |
13 <div id="log"></div> | |
14 <script> | |
15 test(function() { | |
16 var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new Anim
ationSequence([])]; | |
17 nodes.forEach(function(node) { | |
18 assert_equals(node.nextSibling, null, type(node) + '.nextSibling should
be null'); | |
19 }); | |
20 }, 'AnimationNode.nextSibling is null if the node is standalone'); | |
21 | |
22 test(function() { | |
23 var test = this; | |
24 var parents = [AnimationGroup, AnimationSequence]; | |
25 parents.forEach(function(parentCtor) { | |
26 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
27 nodes.forEach(function(node) { | |
28 var parent = new parentCtor([node]); | |
29 | |
30 assert_equals(node.nextSibling, null, type(node) + '.nextSibling ' + | |
31 'should be null'); | |
32 }); | |
33 }); | |
34 }, 'AnimationNode.nextSibling is null if the node is the only child of its paren
t'); | |
35 | |
36 test(function() { | |
37 var test = this; | |
38 var parents = [AnimationGroup, AnimationSequence]; | |
39 parents.forEach(function(parentCtor) { | |
40 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
41 nodes.forEach(function(node1) { | |
42 var node2 = newAnimation(createDiv(test)); | |
43 var parent = new parentCtor([node1, node2]); | |
44 | |
45 assert_equals(node1.nextSibling, node2, type(node1) + '.nextSibling
should return ' + | |
46 'next sibling of this animation node'); | |
47 assert_equals(node2.nextSibling, null, type(node2) + '.nextSibling s
hould be null'); | |
48 }); | |
49 }); | |
50 }, 'AnimationNode.nextSibling returns next sibling of this animation node. Test
first child'); | |
51 | |
52 test(function() { | |
53 var test = this; | |
54 var parents = [AnimationGroup, AnimationSequence]; | |
55 parents.forEach(function(parentCtor) { | |
56 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
57 nodes.forEach(function(node2) { | |
58 var node1 = newAnimation(createDiv(test)); | |
59 var parent = new parentCtor([node1, node2]); | |
60 | |
61 assert_equals(node1.nextSibling, node2, type(node1) + '.nextSibling
should return ' + | |
62 'next sibling of this animation node'); | |
63 assert_equals(node2.nextSibling, null, type(node2) + '.nextSibling s
hould be null'); | |
64 }); | |
65 }); | |
66 }, 'AnimationNode.nextSibling returns next sibling of this animation node. Test
second child'); | |
67 | |
68 test(function() { | |
69 var node1 = newAnimation(createDiv(this)); | |
70 var node2 = newAnimation(createDiv(this)); | |
71 var node3 = newAnimation(createDiv(this)); | |
72 var node4 = newAnimation(createDiv(this)); | |
73 var node5 = newAnimation(createDiv(this)); | |
74 var node6 = newAnimation(createDiv(this)); | |
75 var node7 = new AnimationGroup([node3, node4]); | |
76 var node8 = new AnimationGroup([node5, node6]); | |
77 var node9 = newAnimation(createDiv(this)); | |
78 var group = new AnimationGroup([node1, node2, node7, node8, node9]); | |
79 | |
80 assert_equals(group.nextSibling, null, 'AnimationNode.nextSibling should ret
urn ' + | |
81 'null (root node)'); | |
82 assert_equals(node1.nextSibling, node2, 'AnimationNode.nextSibling should re
turn ' + | |
83 'next sibling for the first node in the group'); | |
84 assert_equals(node2.nextSibling, node7, 'AnimationNode.nextSibling should re
turn ' + | |
85 'next sibling of this animation node'); | |
86 assert_equals(node3.nextSibling, node4, 'AnimationNode.nextSibling should re
turn ' + | |
87 'next sibling of this animation node (first node in the nested group)'); | |
88 assert_equals(node4.nextSibling, null, 'AnimationNode.nextSibling should be
null ' + | |
89 'for the last node in the nested group'); | |
90 assert_equals(node5.nextSibling, node6, 'AnimationNode.nextSibling shoul
d return ' + | |
91 'next sibling of this animation node (first node in the second nested gr
oup)'); | |
92 assert_equals(node6.nextSibling, null, 'AnimationNode.nextSibling should be
null ' + | |
93 'for the last node in the second nested group'); | |
94 assert_equals(node7.nextSibling, node8, 'AnimationNode.nextSibling should re
turn ' + | |
95 'next sibling of this animation node (first nested group)'); | |
96 assert_equals(node8.nextSibling, node9, 'AnimationNode.nextSibling should re
turn ' + | |
97 'next sibling of this animation node (second nested group)'); | |
98 assert_equals(node9.nextSibling, null, 'AnimationNode.nextSibling should ret
urn ' + | |
99 'null (the last node)'); | |
100 }, 'AnimationNode.nextSibling returns next sibling of this animation node. Test
' + | |
101 'tree structure with AnimationGroup'); | |
102 | |
103 test(function() { | |
104 var node1 = newAnimation(createDiv(this)); | |
105 var node2 = newAnimation(createDiv(this)); | |
106 var node3 = newAnimation(createDiv(this)); | |
107 var node4 = newAnimation(createDiv(this)); | |
108 var node5 = newAnimation(createDiv(this)); | |
109 var node6 = newAnimation(createDiv(this)); | |
110 var node7 = new AnimationSequence([node3, node4]); | |
111 var node8 = new AnimationSequence([node5, node6]); | |
112 var node9 = newAnimation(createDiv(this)); | |
113 var sequence = new AnimationSequence([node1, node2, node7, node8, node9]); | |
114 | |
115 assert_equals(sequence.nextSibling, null, 'AnimationNode.nextSibling should
return ' + | |
116 'null (root node)'); | |
117 assert_equals(node1.nextSibling, node2, 'AnimationNode.nextSibling should re
turn ' + | |
118 'next sibling for the first node in the sequence'); | |
119 assert_equals(node2.nextSibling, node7, 'AnimationNode.nextSibling should re
turn ' + | |
120 'next sibling of this animation node'); | |
121 assert_equals(node3.nextSibling, node4, 'AnimationNode.nextSibling should re
turn ' + | |
122 'next sibling of this animation node (first node in the nested sequence)
'); | |
123 assert_equals(node4.nextSibling, null, 'AnimationNode.nextSibling should be
null ' + | |
124 'for the last node in the nested sequence'); | |
125 assert_equals(node5.nextSibling, node6, 'AnimationNode.nextSibling shoul
d return ' + | |
126 'next sibling of this animation node (first node in the second nested se
quence)'); | |
127 assert_equals(node6.nextSibling, null, 'AnimationNode.nextSibling should be
null ' + | |
128 'for the last node in the second nested sequence'); | |
129 assert_equals(node7.nextSibling, node8, 'AnimationNode.nextSibling should re
turn ' + | |
130 'next sibling of this animation node (first nested sequence)'); | |
131 assert_equals(node8.nextSibling, node9, 'AnimationNode.nextSibling should re
turn ' + | |
132 'next sibling of this animation node (second nested sequence)'); | |
133 assert_equals(node9.nextSibling, null, 'AnimationNode.nextSibling should ret
urn ' + | |
134 'null (the last node)'); | |
135 }, 'AnimationNode.nextSibling returns next sibling of this animation node. Test
' + | |
136 'tree structure with AnimationSequence'); | |
137 | |
138 test(function() { | |
139 var test = this; | |
140 var parents = [AnimationGroup, AnimationSequence]; | |
141 parents.forEach(function(parentCtor) { | |
142 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
143 nodes.forEach(function(node2) { | |
144 var node1 = newAnimation(createDiv(test)); | |
145 var node3 = newAnimation(createDiv(test)); | |
146 var parent = new parentCtor([node1, node2]); | |
147 node2.before(node3); | |
148 | |
149 assert_equals(node1.nextSibling, node3, type(node2) + '.before() sho
uld update ' + | |
150 'next sibling of animation node'); | |
151 assert_equals(node3.nextSibling, node2, type(node2) + '.before() sho
uld update ' + | |
152 'next sibling of animation node'); | |
153 assert_equals(node2.nextSibling, null, type(node2) + '.before() shou
ld update ' + | |
154 'next sibling of animation node'); | |
155 }); | |
156 }); | |
157 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
158 'the next sibling is changed by method before()'); | |
159 | |
160 test(function() { | |
161 var test = this; | |
162 var parents = [AnimationGroup, AnimationSequence]; | |
163 parents.forEach(function(parentCtor) { | |
164 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
165 nodes.forEach(function(node3) { | |
166 var node1 = newAnimation(createDiv(test)); | |
167 var node2 = newAnimation(createDiv(test)); | |
168 var parent1 = new parentCtor([node1, node2]); | |
169 var parent2 = new parentCtor([node3]); | |
170 | |
171 node3.before(node2); | |
172 | |
173 assert_equals(node1.nextSibling, null, type(node3) + '.before() shou
ld update ' + | |
174 'next sibling of animation node'); | |
175 assert_equals(node2.nextSibling, node3, type(node3) + '.before() sho
uld update ' + | |
176 'next sibling of animation node'); | |
177 }); | |
178 }); | |
179 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
180 'the next sibling is removed by method before()'); | |
181 | |
182 test(function() { | |
183 var test = this; | |
184 var parents = [AnimationGroup, AnimationSequence]; | |
185 parents.forEach(function(parentCtor) { | |
186 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
187 nodes.forEach(function(node2) { | |
188 var node1 = newAnimation(createDiv(test)); | |
189 var node3 = newAnimation(createDiv(test)); | |
190 var node4 = new AnimationGroup([]); | |
191 var node5 = new AnimationSequence([]); | |
192 var parent = new parentCtor([node1, node2]); | |
193 node2.before(node3, node4, node5); | |
194 | |
195 assert_equals(node1.nextSibling, node3, type(node2) + '.before() sho
uld update ' + | |
196 'next sibling of animation node'); | |
197 assert_equals(node3.nextSibling, node4, type(node2) + '.before() sho
uld update ' + | |
198 'next sibling of animation node'); | |
199 assert_equals(node4.nextSibling, node5, type(node2) + '.before() sho
uld update ' + | |
200 'next sibling of animation node'); | |
201 assert_equals(node5.nextSibling, node2, type(node2) + '.before() sho
uld update ' + | |
202 'next sibling of animation node'); | |
203 assert_equals(node2.nextSibling, null, type(node2) + '.before() shou
ld update ' + | |
204 'next sibling of animation node'); | |
205 }); | |
206 }); | |
207 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
208 'several nodes are added by method before()'); | |
209 | |
210 test(function() { | |
211 var test = this; | |
212 var parents = [AnimationGroup, AnimationSequence]; | |
213 parents.forEach(function(parentCtor) { | |
214 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
215 nodes.forEach(function(node1) { | |
216 var node2 = newAnimation(createDiv(test)); | |
217 var node3 = newAnimation(createDiv(test)); | |
218 var parent = new parentCtor([node1, node2]); | |
219 node1.after(node3); | |
220 | |
221 assert_equals(node1.nextSibling, node3, type(node1) + '.after() shou
ld update ' + | |
222 'next sibling of animation node'); | |
223 assert_equals(node3.nextSibling, node2, type(node1) + '.after() shou
ld update ' + | |
224 'next sibling of animation node'); | |
225 assert_equals(node2.nextSibling, null, type(node1) + '.after() shoul
d update ' + | |
226 'next sibling of animation node'); | |
227 }); | |
228 }); | |
229 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
230 'the next sibling is changed by method after()'); | |
231 | |
232 test(function() { | |
233 var test = this; | |
234 var parents = [AnimationGroup, AnimationSequence]; | |
235 parents.forEach(function(parentCtor) { | |
236 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
237 nodes.forEach(function(node3) { | |
238 var node1 = newAnimation(createDiv(test)); | |
239 var node2 = newAnimation(createDiv(test)); | |
240 var parent1 = new parentCtor([node1, node2]); | |
241 var parent2 = new parentCtor([node3]); | |
242 | |
243 node3.after(node2); | |
244 | |
245 assert_equals(node1.nextSibling, null, type(node3) + '.after() shoul
d update ' + | |
246 'next sibling of animation node'); | |
247 assert_equals(node3.nextSibling, node2, type(node3) + '.after() shou
ld update ' + | |
248 'next sibling of animation node'); | |
249 }); | |
250 }); | |
251 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
252 'the next sibling is removed by method after()'); | |
253 | |
254 test(function() { | |
255 var test = this; | |
256 var parents = [AnimationGroup, AnimationSequence]; | |
257 parents.forEach(function(parentCtor) { | |
258 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
259 nodes.forEach(function(node1) { | |
260 var node2 = newAnimation(createDiv(test)); | |
261 var node3 = newAnimation(createDiv(test)); | |
262 var node4 = new AnimationGroup([]); | |
263 var node5 = new AnimationSequence([]); | |
264 var parent = new parentCtor([node1, node2]); | |
265 node1.after(node3, node4, node5); | |
266 | |
267 assert_equals(node1.nextSibling, node3, type(node1) + '.after() shou
ld update ' + | |
268 'next sibling of animation node'); | |
269 assert_equals(node3.nextSibling, node4, type(node1) + '.after() shou
ld update ' + | |
270 'next sibling of animation node'); | |
271 assert_equals(node4.nextSibling, node5, type(node1) + '.after() shou
ld update ' + | |
272 'next sibling of animation node'); | |
273 assert_equals(node5.nextSibling, node2, type(node1) + '.after() shou
ld update ' + | |
274 'next sibling of animation node'); | |
275 assert_equals(node2.nextSibling, null, type(node1) + '.after() shoul
d update ' + | |
276 'next sibling of animation node'); | |
277 }); | |
278 }); | |
279 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
280 'several nodes are added by method after()'); | |
281 | |
282 test(function() { | |
283 var test = this; | |
284 var parents = [AnimationGroup, AnimationSequence]; | |
285 parents.forEach(function(parentCtor) { | |
286 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
287 nodes.forEach(function(node2) { | |
288 var node1 = newAnimation(createDiv(test)); | |
289 var node3 = newAnimation(createDiv(test)); | |
290 var node4 = newAnimation(createDiv(test)); | |
291 var parent = new parentCtor([node1, node2, node3]); | |
292 node2.replace(node4); | |
293 | |
294 assert_equals(node1.nextSibling, node4, type(node2) + '.replace() sh
ould update ' + | |
295 'next sibling of animation node'); | |
296 assert_equals(node4.nextSibling, node3, type(node2) + '.replace() sh
ould update ' + | |
297 'next sibling of animation node'); | |
298 assert_equals(node2.nextSibling, null, type(node2) + '.replace() sho
uld update ' + | |
299 'next sibling of animation node'); | |
300 }); | |
301 }); | |
302 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
303 'the next sibling is changed by method replace()'); | |
304 | |
305 test(function() { | |
306 var test = this; | |
307 var parents = [AnimationGroup, AnimationSequence]; | |
308 parents.forEach(function(parentCtor) { | |
309 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
310 nodes.forEach(function(node4) { | |
311 var node1 = newAnimation(createDiv(test)); | |
312 var node2 = newAnimation(createDiv(test)); | |
313 var node3 = newAnimation(createDiv(test)); | |
314 var parent1 = new parentCtor([node1, node2, node3]); | |
315 var parent2 = new parentCtor([node4]); | |
316 | |
317 node4.replace(node2); | |
318 | |
319 assert_equals(node1.nextSibling, node3, type(node4) + '.replace() sh
ould update ' + | |
320 'next sibling of animation node'); | |
321 assert_equals(node2.nextSibling, null, type(node4) + '.replace() sho
uld update ' + | |
322 'next sibling of animation node'); | |
323 }); | |
324 }); | |
325 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
326 'the next sibling is removed by method replace()'); | |
327 | |
328 test(function() { | |
329 var test = this; | |
330 var parents = [AnimationGroup, AnimationSequence]; | |
331 parents.forEach(function(parentCtor) { | |
332 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
333 nodes.forEach(function(node2) { | |
334 var node1 = newAnimation(createDiv(test)); | |
335 var node3 = newAnimation(createDiv(test)); | |
336 var node4 = newAnimation(createDiv(test)); | |
337 var node5 = new AnimationGroup([]); | |
338 var node6 = new AnimationSequence([]); | |
339 var parent = new parentCtor([node1, node2, node3]); | |
340 node2.replace(node4, node5, node6); | |
341 | |
342 assert_equals(node1.nextSibling, node4, type(node2) + '.replace() sh
ould update ' + | |
343 'next sibling of animation node'); | |
344 assert_equals(node4.nextSibling, node5, type(node2) + '.replace() sh
ould update ' + | |
345 'next sibling of animation node'); | |
346 assert_equals(node5.nextSibling, node6, type(node2) + '.replace() sh
ould update ' + | |
347 'next sibling of animation node'); | |
348 assert_equals(node6.nextSibling, node3, type(node2) + '.replace() sh
ould update ' + | |
349 'next sibling of animation node'); | |
350 assert_equals(node2.nextSibling, null, type(node2) + '.replace() sho
uld update ' + | |
351 'next sibling of animation node'); | |
352 }); | |
353 }); | |
354 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
355 'several nodes are added by method replace()'); | |
356 | |
357 test(function() { | |
358 var test = this; | |
359 var parents = [AnimationGroup, AnimationSequence]; | |
360 parents.forEach(function(parentCtor) { | |
361 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
362 nodes.forEach(function(node2) { | |
363 var node1 = newAnimation(createDiv(test)); | |
364 var node3 = newAnimation(createDiv(test)); | |
365 var parent = new parentCtor([node1, node2, node3]); | |
366 node2.remove(); | |
367 | |
368 assert_equals(node1.nextSibling, node3, type(node2) + '.replace() sh
ould update ' + | |
369 'next sibling of animation node'); | |
370 assert_equals(node2.nextSibling, null, type(node2) + '.replace() sho
uld update ' + | |
371 'next sibling of animation node'); | |
372 }); | |
373 }); | |
374 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
375 'the next sibling is changed by method remove()'); | |
376 | |
377 test(function() { | |
378 var test = this; | |
379 var parents = [AnimationGroup, AnimationSequence]; | |
380 parents.forEach(function(parentCtor) { | |
381 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
382 nodes.forEach(function(node2) { | |
383 var node1 = newAnimation(createDiv(test)); | |
384 var parent = new parentCtor([node1]); | |
385 parent.prepend(node2); | |
386 | |
387 assert_equals(node2.nextSibling, node1, parentCtor.name + '.prepend(
) should update ' + | |
388 'next sibling of animation node'); | |
389 }); | |
390 }); | |
391 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
392 'the next sibling is changed by method AnimationGroup.prepend()'); | |
393 | |
394 test(function() { | |
395 var test = this; | |
396 var parents = [AnimationGroup, AnimationSequence]; | |
397 parents.forEach(function(parentCtor) { | |
398 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
399 nodes.forEach(function(node1) { | |
400 var node2 = newAnimation(createDiv(test)); | |
401 var node3 = newAnimation(createDiv(test)); | |
402 var parent1 = new parentCtor([node1, node2]); | |
403 var parent2 = new parentCtor([node3]); | |
404 | |
405 parent2.prepend(node2); | |
406 | |
407 assert_equals(node1.nextSibling, null, parentCtor.name + '.prepend()
should update ' + | |
408 'next sibling of animation node'); | |
409 assert_equals(node2.nextSibling, node3, parentCtor.name + '.prepend(
) should update ' + | |
410 'next sibling of animation node'); | |
411 }); | |
412 }); | |
413 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
414 'the next sibling is removed by method AnimationGroup.prepend()'); | |
415 | |
416 test(function() { | |
417 var test = this; | |
418 var parents = [AnimationGroup, AnimationSequence]; | |
419 parents.forEach(function(parentCtor) { | |
420 var node1 = newAnimation(createDiv(test)); | |
421 var node2 = new AnimationGroup([]); | |
422 var node3 = new AnimationSequence([]); | |
423 var node4 = newAnimation(createDiv(test)); | |
424 var parent = new parentCtor([node1]); | |
425 parent.prepend(node2, node3, node4); | |
426 | |
427 assert_equals(node2.nextSibling, node3, parentCtor.name + '.prepend() sh
ould update ' + | |
428 'next sibling of animation node'); | |
429 assert_equals(node3.nextSibling, node4, parentCtor.name + '.prepend() sh
ould update ' + | |
430 'next sibling of animation node'); | |
431 assert_equals(node4.nextSibling, node1, parentCtor.name + '.prepend() sh
ould update ' + | |
432 'next sibling of animation node'); | |
433 }); | |
434 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
435 'several nodes are added by method AnimationGroup.prepend()'); | |
436 | |
437 test(function() { | |
438 var test = this; | |
439 var parents = [AnimationGroup, AnimationSequence]; | |
440 parents.forEach(function(parentCtor) { | |
441 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
442 nodes.forEach(function(node1) { | |
443 var node2 = newAnimation(createDiv(test)); | |
444 var parent = new parentCtor([node1]); | |
445 parent.append(node2); | |
446 | |
447 assert_equals(node1.nextSibling, node2, parentCtor.name + '.append()
should update ' + | |
448 'next sibling of animation node'); | |
449 assert_equals(node2.nextSibling, null, parentCtor.name + '.append()
should update ' + | |
450 'next sibling of animation node'); | |
451 }); | |
452 }); | |
453 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
454 'the next sibling is changed by method AnimationGroup.append()'); | |
455 | |
456 test(function() { | |
457 var test = this; | |
458 var parents = [AnimationGroup, AnimationSequence]; | |
459 parents.forEach(function(parentCtor) { | |
460 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
461 nodes.forEach(function(node1) { | |
462 var node2 = newAnimation(createDiv(test)); | |
463 var node3 = newAnimation(createDiv(test)); | |
464 var parent1 = new parentCtor([node1, node2]); | |
465 var parent2 = new parentCtor([node3]); | |
466 | |
467 parent2.append(node2); | |
468 | |
469 assert_equals(node1.nextSibling, null, parentCtor.name + '.append()
should update ' + | |
470 'next sibling of animation node'); | |
471 assert_equals(node3.nextSibling, node2, parentCtor.name + '.append()
should update ' + | |
472 'next sibling of animation node'); | |
473 }); | |
474 }); | |
475 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
476 'the next sibling is removed by method AnimationGroup.append()'); | |
477 | |
478 test(function() { | |
479 var test = this; | |
480 var parents = [AnimationGroup, AnimationSequence]; | |
481 parents.forEach(function(parentCtor) { | |
482 var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new
AnimationSequence([])]; | |
483 nodes.forEach(function(node1) { | |
484 var node2 = newAnimation(createDiv(test)); | |
485 var node3 = new AnimationGroup([]); | |
486 var node4 = new AnimationSequence([]); | |
487 var parent = new parentCtor([node1]); | |
488 parent.append(node2, node3, node4); | |
489 | |
490 assert_equals(node1.nextSibling, node2, parentCtor.name + '.append()
should update ' + | |
491 'next sibling of animation node'); | |
492 assert_equals(node2.nextSibling, node3, parentCtor.name + '.append()
should update ' + | |
493 'next sibling of animation node'); | |
494 assert_equals(node3.nextSibling, node4, parentCtor.name + '.append()
should update ' + | |
495 'next sibling of animation node'); | |
496 assert_equals(node4.nextSibling, null, parentCtor.name + '.append()
should update ' + | |
497 'next sibling of animation node'); | |
498 }); | |
499 }); | |
500 }, 'AnimationNode.nextSibling returns next sibling of this animation node, ' + | |
501 'several nodes are added by method AnimationGroup.append()'); | |
502 </script> | |
503 </body> | |
OLD | NEW |