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