mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Bug 1259321 - Remove animation node test from web platform tests. r=birtles
This commit is contained in:
parent
7167af4f5a
commit
d7384d58c0
@ -28417,38 +28417,6 @@
|
||||
"path": "web-animations/animation-effect-timing/direction.html",
|
||||
"url": "/web-animations/animation-effect-timing/direction.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-after.html",
|
||||
"url": "/web-animations/animation-node/animation-node-after.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-before.html",
|
||||
"url": "/web-animations/animation-node/animation-node-before.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-next-sibling.html",
|
||||
"url": "/web-animations/animation-node/animation-node-next-sibling.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-parent.html",
|
||||
"url": "/web-animations/animation-node/animation-node-parent.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-previous-sibling.html",
|
||||
"url": "/web-animations/animation-node/animation-node-previous-sibling.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-remove.html",
|
||||
"url": "/web-animations/animation-node/animation-node-remove.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/animation-node-replace.html",
|
||||
"url": "/web-animations/animation-node/animation-node-replace.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-node/idlharness.html",
|
||||
"url": "/web-animations/animation-node/idlharness.html"
|
||||
},
|
||||
{
|
||||
"path": "web-animations/animation-timeline/document-timeline.html",
|
||||
"url": "/web-animations/animation-timeline/document-timeline.html"
|
||||
|
@ -1,50 +0,0 @@
|
||||
[animation-node-after.html]
|
||||
type: testharness
|
||||
[AnimationNode.after() does nothing if the node has no parent animation group. HierarchyRequestError is not thrown in call node.after(null)]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.after() does nothing if the node has no parent animation group. No HierarchyRequestError is thrown if the node is inserted after itself]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.after() does nothing if there is no parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if node is inserted after itself]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if direct parent is inserted after the node]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if an inclusive ancestor is inserted after the node]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if an inclusive ancestor is inserted after the node. Test several arguments in after() call]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.after() inserts nodes after this node]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.after() inserts nodes after this node. Inserted node is on the same level in the tree]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() inserts node after this node even if inserted node is already after this one]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() inserts node after this node. The previous position of the inserted node is deeper in the tree than current node]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() inserts node after this node. The previous position of the inserted node is shallower in the tree than current node, but not ancestor]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() inserts several nodes after this node]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() inserts several nodes after this node, duplicate nodes are ignored]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() inserts several nodes after this node, check insertion order]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.after() disassociates the inserted node from the player, if node is directly associated with a player]
|
||||
expected: FAIL
|
||||
|
@ -1,50 +0,0 @@
|
||||
[animation-node-before.html]
|
||||
type: testharness
|
||||
[AnimationNode.before() does nothing if the node has no parent animation group. HierarchyRequestError is not thrown in call node.before(null)]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.before() does nothing if the node has no parent animation group. No HierarchyRequestError is thrown if the node is inserted before itself]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.before() does nothing if there is no parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if node is inserted before itself]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if direct parent is inserted before the node]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if an inclusive ancestor is inserted before the node]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if an inclusive ancestor is inserted before the node. Test several arguments in before() call]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.before() inserts nodes before this node]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.before() inserts nodes before this node. Inserted node is on the same level in the tree]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() inserts node before this node even if inserted node is already before this one]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() inserts node before this node. The previous position of the inserted node is deeper in the tree than current node]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() inserts node before this node. The previous position of the inserted node is shallower in the tree than current node, but not ancestor]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() inserts several nodes before this node]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() inserts several nodes before this node, duplicate nodes are ignored]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() inserts several nodes before this node, check insertion order]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.before() disassociates the inserted node from the player, if node is directly associated with a player]
|
||||
expected: FAIL
|
||||
|
@ -1,68 +0,0 @@
|
||||
[animation-node-next-sibling.html]
|
||||
type: testharness
|
||||
[AnimationNode.nextSibling is null if the node is standalone]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling is null if the node is the only child of its parent]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node. Test first child]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node. Test second child]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node. Test tree structure with AnimationGroup]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node. Test tree structure with AnimationSequence]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is changed by method before()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is removed by method before()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, several nodes are added by method before()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is changed by method after()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is removed by method after()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, several nodes are added by method after()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is changed by method replace()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is removed by method replace()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, several nodes are added by method replace()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is changed by method remove()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is changed by method AnimationGroup.prepend()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is removed by method AnimationGroup.prepend()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, several nodes are added by method AnimationGroup.prepend()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is changed by method AnimationGroup.append()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, the next sibling is removed by method AnimationGroup.append()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.nextSibling returns next sibling of this animation node, several nodes are added by method AnimationGroup.append()]
|
||||
expected: FAIL
|
||||
|
@ -1,11 +0,0 @@
|
||||
[animation-node-parent.html]
|
||||
type: testharness
|
||||
[AnimationNode.parent is null if animation node does not have a parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.parent returns parent animation group of this animation node]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.parent returns parent animation group of this animation node. The group has several children nodes]
|
||||
expected: FAIL
|
||||
|
@ -1,68 +0,0 @@
|
||||
[animation-node-previous-sibling.html]
|
||||
type: testharness
|
||||
[AnimationNode.previousSibling is null if the node is standalone]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling is null if the node is the only child of its parent]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node. Test first child]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node. Test second child]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node. Test tree structure with AnimationGroup]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node. Test tree structure with AnimationSequence]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is changed by method before()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is removed by method before()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, several nodes are added by method before()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is changed by method after()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is removed by method after()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, several nodes are added by method after()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is changed by method replace()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is removed by method replace()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, several nodes are added by method replace()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is changed by method remove()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is changed by method AnimationGroup.prepend()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is removed by method AnimationGroup.prepend()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, several nodes are added by method AnimationGroup.prepend()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is changed by method AnimationGroup.append()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, the previous sibling is removed by method AnimationGroup.append()]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.previousSibling returns previous sibling of this animation node, several nodes are added by method AnimationGroup.append()]
|
||||
expected: FAIL
|
||||
|
@ -1,29 +0,0 @@
|
||||
[animation-node-remove.html]
|
||||
type: testharness
|
||||
[AnimationNode.remove() does nothing for standalone node]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() removes node from the parent animation group. Removed node is the only node in the tree]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() removes node from the parent animation group. Remove the first node in the group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() removes node from the parent animation group. Remove the last node in the group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() removes node from the parent animation group. Remove node from the middle of the group]
|
||||
expected: FAIL
|
||||
|
||||
[Test removing a node that has children]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() disassociates the node from player, if node is directly associated with a player]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() keeps parent direct association with the player]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.remove() on the root of a non-trivial tree does not change child structure]
|
||||
expected: FAIL
|
||||
|
@ -1,53 +0,0 @@
|
||||
[animation-node-replace.html]
|
||||
type: testharness
|
||||
[AnimationNode.replace(null) does nothing if node has no parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.replace() does nothing if node has no parent animation group. HierarchyRequestError is not thrown if the node is replacing itself]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.replace() does nothing if node has no parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if the node replaces itself]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if the node is replaced by its parent]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if the node is replaced by its inclusive ancestor]
|
||||
expected: FAIL
|
||||
|
||||
[HierarchyRequestError is thrown if node is replaced by its inclusive ancestor. Test several arguments in replace() call]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.replace() without arguments removes the node from the parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.replace() removes the node from its parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.replace(next sibling) removes the node from its parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[AnimationNode.replace() replaces node in the parent animation group]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.replace() replaces given node. The previous position of the replacement node is deeper in the tree than the current node]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.replace() replaces given node. The previous position of the replacement node is shallower in the tree than current node, but is not an ancestor]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.replace() replaces given node. Test several arguments]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.replace() replaces given node by several nodes, duplicate nodes are ignored]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.replace() replaces given node by several nodes, check replacement order]
|
||||
expected: FAIL
|
||||
|
||||
[Test AnimationNode.replace() disassociates the inserted node from the player, if node is directly associated with a player]
|
||||
expected: FAIL
|
||||
|
@ -1,3 +0,0 @@
|
||||
[idlharness.html]
|
||||
type: testharness
|
||||
expected: ERROR
|
@ -1,420 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode after() method tests</title>
|
||||
<meta name="assert" content="Inserts nodes after this animation node">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-after">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#insert-children">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#remove-an-animation-node">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// Test step 1. If there is no parent animation group, terminate these steps.
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
try {
|
||||
node.after(null);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node) + '.after(null) throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.after() does nothing if the node has no parent animation group. ' +
|
||||
'HierarchyRequestError is not thrown in call node.after(null)');
|
||||
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
try {
|
||||
node.after(node);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node) + '.after() throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.after() does nothing if the node has no parent animation group. ' +
|
||||
'No HierarchyRequestError is thrown if the node is inserted after itself');
|
||||
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
var node2 = newAnimation(createDiv(this));
|
||||
nodes.forEach(function(node1) {
|
||||
node1.after(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, null, type(node1) + '.after() should do nothing ' +
|
||||
'if the node has no parent animation group');
|
||||
assert_equals(node2.previousSibling, null, type(node1) + '.after() should do nothing ' +
|
||||
'if the node has no parent animation group');
|
||||
});
|
||||
}, 'AnimationNode.after() does nothing if there is no parent animation group');
|
||||
|
||||
// Test step 2. If any of the animation nodes in nodes is an inclusive ancestor of this animation node throw a HierarchyRequestError exception and terminate these steps.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.after(node);
|
||||
}, type(node) + '.after() should throw HierarchyRequestError ' +
|
||||
'if inserting node after itself');
|
||||
assert_equals(node.parent, parent, type(node) + '.after() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent.children, [node], type(node) + '.after() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if node is inserted after itself');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.after(parent);
|
||||
}, type(node) + '.after() should throw HierarchyRequestError ' +
|
||||
'if inserting node\'s parent');
|
||||
assert_equals(node.parent, parent, type(node) + '.after() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent.children, [node], type(node) + '.after() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if direct parent is inserted after the node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent1 = new parentCtor([node]);
|
||||
var parent2 = new parentCtor([parent1]);
|
||||
var parent3 = new parentCtor([parent2]);
|
||||
var parent4 = new parentCtor([parent3]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.after(parent3);
|
||||
}, type(node) + '.after() should throw HierarchyRequestError ' +
|
||||
'if inserting node\'s ancestor');
|
||||
assert_equals(node.parent, parent1, type(node) + '.after() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent1.children, [node], type(node) + '.after() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
assert_equals(parent3.parent, parent4, type(node) + '.after() should not change ' +
|
||||
'parent attribute of inserted node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent4.children, [parent3], type(node) + '.after() ' +
|
||||
'should not change inserted node parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if an inclusive ancestor is inserted after the node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([parent1]);
|
||||
var parent3 = new parentCtor([parent2]);
|
||||
var parent4 = new parentCtor([parent3]);
|
||||
var parent5 = new ParentCtor([node3]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node1.after(node3, parent3);
|
||||
}, type(node1) + '.after() should throw HierarchyRequestError ' +
|
||||
'if inserting node\'s parent');
|
||||
assert_equals(node1.parent, parent1, type(node1) + '.after() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent1.children, [node1, node2], type(node1) + '.after() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
assert_equals(parent3.parent, parent4, type(node1) + '.after() should not change ' +
|
||||
'parent attribute of inserted node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent4.children, [parent3], type(node1) + '.after() ' +
|
||||
'should not change inserted node parent children before throwing HierarchyRequestError');
|
||||
assert_equals(node3.parent, parent5, type(node1) + '.after() should not change ' +
|
||||
'parent attribute of inserted node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent5.children, [node3], type(node1) + '.after() ' +
|
||||
'should not change inserted node parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if an inclusive ancestor is inserted after the node. ' +
|
||||
'Test several arguments in after() call');
|
||||
|
||||
// Test step 3 and 4.
|
||||
// 3. Let reference child be the next sibling of this animation node not in nodes.
|
||||
// 4. Insert nodes before reference child.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
|
||||
node1.after(node2);
|
||||
|
||||
assert_equals(node2.previousSibling, node1, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node2.parent, parent, 'Node should be inserted into the tree');
|
||||
assert_equals(node1.nextSibling, node2, 'Node should be inserted into the tree ' +
|
||||
'after this node');
|
||||
assert_equals(parent.children, [node1, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.after() inserts nodes after this node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.after(node1);
|
||||
|
||||
assert_equals(node2.previousSibling, null, type(node2) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node2.nextSibling, node1, 'Node should be inserted into the tree ' +
|
||||
'after this node');
|
||||
assert_equals(node1.previousSibling, node2, type(node2) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node1.nextSibling, null, 'Node should be inserted into the tree ' +
|
||||
'after this node');
|
||||
assert_equals(parent.children, [node2, node1], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.after() inserts nodes after this node. Inserted node is on the same ' +
|
||||
'level in the tree');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node1.after(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, node2, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node2.previousSibling, node1, 'Node should be inserted into the tree ' +
|
||||
'after this node');
|
||||
assert_equals(parent.children, [node1, node2], parentCtor.name +
|
||||
'.children should not be changed');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() inserts node after this node even if inserted ' +
|
||||
'node is already after this one');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node3) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3, parent1, node4]);
|
||||
|
||||
node3.after(node1);
|
||||
|
||||
assert_equals(node1.nextSibling, parent1, type(node3) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node1.parent, parent2, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node1.previousSibling, node3, 'Node should be inserted into the tree ' +
|
||||
'after this node');
|
||||
|
||||
assert_equals(node3.nextSibling, node1, type(node3) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(parent1.previousSibling, node1, type(node3) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
|
||||
assert_equals(node2.previousSibling, null, 'Inserted node should be removed from its ' +
|
||||
'previous position in the tree');
|
||||
assert_array_equals(parent1.children, [node2], 'Inserted node should be removed from its ' +
|
||||
'previous position in the tree');
|
||||
assert_array_equals(parent2.children, [node1, node3, parent1, node4], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() inserts node after this node. The previous position ' +
|
||||
'of the inserted node is deeper in the tree than current node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3, parent1, node4]);
|
||||
|
||||
node1.after(node4);
|
||||
|
||||
assert_equals(node4.nextSibling, node2, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.parent, parent1, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node1, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
|
||||
assert_equals(node1.nextSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node2.previousSibling, node4, 'Node should be inserted into the tree ' +
|
||||
'after this node');
|
||||
|
||||
assert_equals(parent1.nextSibling, null, 'Inserted node should be removed from its ' +
|
||||
'previous position in the tree');
|
||||
assert_array_equals(parent1.children, [node1, node4, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
assert_array_equals(parent2.children, [node3, parent1], 'Inserted node should be ' +
|
||||
'removed from its previous position in the tree');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() inserts node after this node. The previous position ' +
|
||||
'of the inserted node is shallower in the tree than current node, but not ancestor');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node1.after(node3, node4);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.previousSibling, node1, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.nextSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node3, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.nextSibling, node2, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node2.previousSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_array_equals(parent.children, [node1, node3, node4, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() inserts several nodes after this node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node1.after(node3, node4, node3, node4);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.previousSibling, node1, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.nextSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node3, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.nextSibling, node2, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node2.previousSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_array_equals(parent.children, [node1, node3, node4, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() inserts several nodes after this node, duplicate nodes are ignored');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node1.after(node3, node4, node3);
|
||||
|
||||
assert_equals(node1.nextSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.previousSibling, node1, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.nextSibling, node3, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node3.previousSibling, node4, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.nextSibling, node2, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node2.previousSibling, node3, type(node1) + '.after() should insert ' +
|
||||
'nodes after this node');
|
||||
assert_array_equals(parent.children, [node1, node4, node3, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() inserts several nodes after this node, check insertion order');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
var player = document.timeline.play(node2);
|
||||
|
||||
assert_equals(player.source, node2, 'The node should be associated with its player');
|
||||
node1.after(node2);
|
||||
assert_equals(player.source, null, 'The node should be disassociated from its player');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.after() disassociates the inserted node from the player, ' +
|
||||
'if node is directly associated with a player');
|
||||
</script>
|
||||
</body>
|
@ -1,419 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode before() method tests</title>
|
||||
<meta name="assert" content="Inserts nodes before this animation node.">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-before">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#insert-children">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#remove-an-animation-node">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// Test step 1. If there is no parent animation group, terminate these steps.
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
try {
|
||||
node.before(null);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node) + '.before(null) throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.before() does nothing if the node has no parent animation group. ' +
|
||||
'HierarchyRequestError is not thrown in call node.before(null)');
|
||||
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
try {
|
||||
node.before(node);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node) + '.before() throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.before() does nothing if the node has no parent animation group. ' +
|
||||
'No HierarchyRequestError is thrown if the node is inserted before itself');
|
||||
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
var node2 = newAnimation(createDiv(this));
|
||||
nodes.forEach(function(node1) {
|
||||
node1.before(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, null, type(node1) + '.before() should do nothing ' +
|
||||
'if the node has no parent animation group');
|
||||
assert_equals(node2.previousSibling, null, type(node1) + '.before() should do nothing ' +
|
||||
'if the node has no parent animation group');
|
||||
});
|
||||
}, 'AnimationNode.before() does nothing if there is no parent animation group');
|
||||
|
||||
// Test step 2. If any of the animation nodes in nodes is an inclusive ancestor of this animation node throw a HierarchyRequestError exception and terminate these steps.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.before(node);
|
||||
}, type(node) + '.before() should throw HierarchyRequestError ' +
|
||||
'if inserting node before itself');
|
||||
assert_equals(node.parent, parent, type(node) + '.before() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent.children, [node], type(node) + '.before() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if node is inserted before itself');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.before(parent);
|
||||
}, type(node) + '.before() should throw HierarchyRequestError ' +
|
||||
'if inserting node\'s parent');
|
||||
assert_equals(node.parent, parent, type(node) + '.before() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent.children, [node], type(node) + '.before() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if direct parent is inserted before the node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent1 = new parentCtor([node]);
|
||||
var parent2 = new parentCtor([parent1]);
|
||||
var parent3 = new parentCtor([parent2]);
|
||||
var parent4 = new parentCtor([parent3]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.before(parent4);
|
||||
}, type(node) + '.before() should throw HierarchyRequestError ' +
|
||||
'if inserting node\'s ancestor');
|
||||
assert_equals(node.parent, parent1, type(node) + '.before() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent1.children, [node], type(node) + '.before() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
assert_equals(parent3.parent, parent4, type(node) + '.before() should not change ' +
|
||||
'parent attribute of inserted node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent4.children, [parent3], type(node) + '.before() ' +
|
||||
'should not change inserted node parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if an inclusive ancestor is inserted before the node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([parent1]);
|
||||
var parent3 = new parentCtor([parent2]);
|
||||
var parent4 = new parentCtor([parent3]);
|
||||
var parent5 = new ParentCtor([node3]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node1.before(node3, parent3);
|
||||
}, type(node1) + '.before() should throw HierarchyRequestError ' +
|
||||
'if inserting node\'s parent');
|
||||
assert_equals(node1.parent, parent1, type(node1) + '.before() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent1.children, [node1, node2], type(node1) + '.before() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
assert_equals(parent3.parent, parent4, type(node1) + '.before() should not change ' +
|
||||
'parent attribute of inserted node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent4.children, [parent3], type(node1) + '.before() ' +
|
||||
'should not change inserted node parent children before throwing HierarchyRequestError');
|
||||
assert_equals(node3.parent, parent5, type(node1) + '.before() should not change ' +
|
||||
'parent attribute of inserted node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent5.children, [node3], type(node1) + '.before() ' +
|
||||
'should not change inserted node parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if an inclusive ancestor is inserted before the node. ' +
|
||||
'Test several arguments in before() call');
|
||||
|
||||
// Test step 3. Insert nodes before this animation node.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
|
||||
node1.before(node2);
|
||||
|
||||
assert_equals(node1.previousSibling, node2, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node2.parent, parent, 'Node should be inserted into the tree');
|
||||
assert_equals(node2.nextSibling, node1, 'Node should be inserted into the tree ' +
|
||||
'before this node');
|
||||
assert_equals(parent.children, [node2, node1], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.before() inserts nodes before this node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node1.before(node2);
|
||||
|
||||
assert_equals(node2.previousSibling, null, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node2.nextSibling, node1, 'Node should be inserted into the tree ' +
|
||||
'before this node');
|
||||
assert_equals(node1.previousSibling, node2, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node1.nextSibling, null, 'Node should be inserted into the tree ' +
|
||||
'before this node');
|
||||
assert_equals(parent.children, [node2, node1], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.before() inserts nodes before this node. Inserted node is on the same ' +
|
||||
'level in the tree');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.before(node1);
|
||||
|
||||
assert_equals(node1.nextSibling, node2, type(node2) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node2.previousSibling, node1, 'Node should be inserted into the tree ' +
|
||||
'before this node');
|
||||
assert_equals(parent.children, [node1, node2], parentCtor.name +
|
||||
'.children should not be changed');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() inserts node before this node even if inserted ' +
|
||||
'node is already before this one');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node4) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3, parent1, node4]);
|
||||
|
||||
node4.before(node1);
|
||||
|
||||
assert_equals(node1.nextSibling, parent1, type(node4) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node1.parent, parent2, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node1.previousSibling, parent1, 'Node should be inserted into the tree ' +
|
||||
'before this node');
|
||||
|
||||
assert_equals(parent1.nextSibling, node1, type(node4) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.previousSibling, node1, type(node4) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
|
||||
assert_equals(node2.previousSibling, null, 'Inserted node should be removed from its ' +
|
||||
'previous position in the tree');
|
||||
assert_array_equals(parent1.children, [node2], 'Inserted node should be removed from its ' +
|
||||
'previous position in the tree');
|
||||
assert_array_equals(parent2.children, [node3, parent1, node1, node4], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() inserts node before this node. The previous position ' +
|
||||
'of the inserted node is deeper in the tree than current node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3, parent1, node4]);
|
||||
|
||||
node2.before(node4);
|
||||
|
||||
assert_equals(node4.nextSibling, node2, type(node2) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.parent, parent1, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node1, type(node2) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
|
||||
assert_equals(node1.nextSibling, node4, type(node2) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node2.previousSibling, node4, 'Node should be inserted into the tree ' +
|
||||
'before this node');
|
||||
|
||||
assert_equals(parent1.nextSibling, null, 'Inserted node should be removed from its ' +
|
||||
'previous position in the tree');
|
||||
assert_array_equals(parent1.children, [node1, node4, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
assert_array_equals(parent2.children, [node3, parent1], 'Inserted node should be ' +
|
||||
'removed from its previous position in the tree');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() inserts node before this node. The previous position ' +
|
||||
'of the inserted node is shallower in the tree than current node, but not ancestor');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.before(node3, node4);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.previousSibling, node1, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.nextSibling, node4, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node3, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.nextSibling, node2, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node2.previousSibling, node4, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_array_equals(parent.children, [node1, node3, node4, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() inserts several nodes before this node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.before(node3, node4, node3, node4);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.previousSibling, node1, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.nextSibling, node4, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node3, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.nextSibling, node2, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node2.previousSibling, node4, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_array_equals(parent.children, [node1, node3, node4, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() inserts several nodes before this node, duplicate nodes are ignored');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.before(node3, node4, node3);
|
||||
|
||||
assert_equals(node1.nextSibling, node4, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.previousSibling, node1, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.nextSibling, node3, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node3.previousSibling, node4, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.nextSibling, node2, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node2.previousSibling, node3, type(node1) + '.before() should insert ' +
|
||||
'nodes before this node');
|
||||
assert_array_equals(parent.children, [node1, node4, node3, node2], parentCtor.name +
|
||||
'.children should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() inserts several nodes before this node, check insertion order');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
var player = document.timeline.play(node2);
|
||||
|
||||
assert_equals(player.source, node2, 'The node should be associated with its player');
|
||||
node1.before(node2);
|
||||
assert_equals(player.source, null, 'The node should be disassociated from its player');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.before() disassociates the inserted node from the player, ' +
|
||||
'if node is directly associated with a player');
|
||||
</script>
|
||||
</body>
|
@ -1,504 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode nextSibling attribute tests</title>
|
||||
<meta name="assert" content="The next sibling of this animation node">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-nextsibling">
|
||||
<link rel="help" href="http://www.w3.org/TR/dom/#concept-tree-next-sibling">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
assert_equals(node.nextSibling, null, type(node) + '.nextSibling should be null');
|
||||
});
|
||||
}, 'AnimationNode.nextSibling is null if the node is standalone');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_equals(node.nextSibling, null, type(node) + '.nextSibling ' +
|
||||
'should be null');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling is null if the node is the only child of its parent');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
assert_equals(node1.nextSibling, node2, type(node1) + '.nextSibling should return ' +
|
||||
'next sibling of this animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.nextSibling should be null');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node. Test first child');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
assert_equals(node1.nextSibling, node2, type(node1) + '.nextSibling should return ' +
|
||||
'next sibling of this animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.nextSibling should be null');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node. Test second child');
|
||||
|
||||
test(function() {
|
||||
var node1 = newAnimation(createDiv(this));
|
||||
var node2 = newAnimation(createDiv(this));
|
||||
var node3 = newAnimation(createDiv(this));
|
||||
var node4 = newAnimation(createDiv(this));
|
||||
var node5 = newAnimation(createDiv(this));
|
||||
var node6 = newAnimation(createDiv(this));
|
||||
var node7 = new AnimationGroup([node3, node4]);
|
||||
var node8 = new AnimationGroup([node5, node6]);
|
||||
var node9 = newAnimation(createDiv(this));
|
||||
var group = new AnimationGroup([node1, node2, node7, node8, node9]);
|
||||
|
||||
assert_equals(group.nextSibling, null, 'AnimationNode.nextSibling should return ' +
|
||||
'null (root node)');
|
||||
assert_equals(node1.nextSibling, node2, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling for the first node in the group');
|
||||
assert_equals(node2.nextSibling, node7, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node');
|
||||
assert_equals(node3.nextSibling, node4, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (first node in the nested group)');
|
||||
assert_equals(node4.nextSibling, null, 'AnimationNode.nextSibling should be null ' +
|
||||
'for the last node in the nested group');
|
||||
assert_equals(node5.nextSibling, node6, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (first node in the second nested group)');
|
||||
assert_equals(node6.nextSibling, null, 'AnimationNode.nextSibling should be null ' +
|
||||
'for the last node in the second nested group');
|
||||
assert_equals(node7.nextSibling, node8, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (first nested group)');
|
||||
assert_equals(node8.nextSibling, node9, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (second nested group)');
|
||||
assert_equals(node9.nextSibling, null, 'AnimationNode.nextSibling should return ' +
|
||||
'null (the last node)');
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node. Test ' +
|
||||
'tree structure with AnimationGroup');
|
||||
|
||||
test(function() {
|
||||
var node1 = newAnimation(createDiv(this));
|
||||
var node2 = newAnimation(createDiv(this));
|
||||
var node3 = newAnimation(createDiv(this));
|
||||
var node4 = newAnimation(createDiv(this));
|
||||
var node5 = newAnimation(createDiv(this));
|
||||
var node6 = newAnimation(createDiv(this));
|
||||
var node7 = new AnimationSequence([node3, node4]);
|
||||
var node8 = new AnimationSequence([node5, node6]);
|
||||
var node9 = newAnimation(createDiv(this));
|
||||
var sequence = new AnimationSequence([node1, node2, node7, node8, node9]);
|
||||
|
||||
assert_equals(sequence.nextSibling, null, 'AnimationNode.nextSibling should return ' +
|
||||
'null (root node)');
|
||||
assert_equals(node1.nextSibling, node2, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling for the first node in the sequence');
|
||||
assert_equals(node2.nextSibling, node7, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node');
|
||||
assert_equals(node3.nextSibling, node4, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (first node in the nested sequence)');
|
||||
assert_equals(node4.nextSibling, null, 'AnimationNode.nextSibling should be null ' +
|
||||
'for the last node in the nested sequence');
|
||||
assert_equals(node5.nextSibling, node6, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (first node in the second nested sequence)');
|
||||
assert_equals(node6.nextSibling, null, 'AnimationNode.nextSibling should be null ' +
|
||||
'for the last node in the second nested sequence');
|
||||
assert_equals(node7.nextSibling, node8, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (first nested sequence)');
|
||||
assert_equals(node8.nextSibling, node9, 'AnimationNode.nextSibling should return ' +
|
||||
'next sibling of this animation node (second nested sequence)');
|
||||
assert_equals(node9.nextSibling, null, 'AnimationNode.nextSibling should return ' +
|
||||
'null (the last node)');
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node. Test ' +
|
||||
'tree structure with AnimationSequence');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node2.before(node3);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node2, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is changed by method before()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node3) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
node3.before(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, null, type(node3) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, node3, type(node3) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is removed by method before()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = new AnimationGroup([]);
|
||||
var node5 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node2.before(node3, node4, node5);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node4, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node4.nextSibling, node5, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node5.nextSibling, node2, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.before() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'several nodes are added by method before()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node1.after(node3);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node2, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is changed by method after()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node3) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
node3.after(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, null, type(node3) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node2, type(node3) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is removed by method after()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = new AnimationGroup([]);
|
||||
var node5 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node1.after(node3, node4, node5);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node4, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node4.nextSibling, node5, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node5.nextSibling, node2, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node1) + '.after() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'several nodes are added by method after()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
node2.replace(node4);
|
||||
|
||||
assert_equals(node1.nextSibling, node4, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node4.nextSibling, node3, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is changed by method replace()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node4) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2, node3]);
|
||||
var parent2 = new parentCtor([node4]);
|
||||
|
||||
node4.replace(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node4) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node4) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is removed by method replace()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var node5 = new AnimationGroup([]);
|
||||
var node6 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
node2.replace(node4, node5, node6);
|
||||
|
||||
assert_equals(node1.nextSibling, node4, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node4.nextSibling, node5, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node5.nextSibling, node6, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node6.nextSibling, node3, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'several nodes are added by method replace()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
node2.remove();
|
||||
|
||||
assert_equals(node1.nextSibling, node3, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, type(node2) + '.replace() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is changed by method remove()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.prepend(node2);
|
||||
|
||||
assert_equals(node2.nextSibling, node1, parentCtor.name + '.prepend() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is changed by method AnimationGroup.prepend()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
parent2.prepend(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, null, parentCtor.name + '.prepend() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, node3, parentCtor.name + '.prepend() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is removed by method AnimationGroup.prepend()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = new AnimationGroup([]);
|
||||
var node3 = new AnimationSequence([]);
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.prepend(node2, node3, node4);
|
||||
|
||||
assert_equals(node2.nextSibling, node3, parentCtor.name + '.prepend() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node4, parentCtor.name + '.prepend() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node4.nextSibling, node1, parentCtor.name + '.prepend() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'several nodes are added by method AnimationGroup.prepend()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.append(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, node2, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, null, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is changed by method AnimationGroup.append()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
parent2.append(node2);
|
||||
|
||||
assert_equals(node1.nextSibling, null, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node2, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'the next sibling is removed by method AnimationGroup.append()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = new AnimationGroup([]);
|
||||
var node4 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.append(node2, node3, node4);
|
||||
|
||||
assert_equals(node1.nextSibling, node2, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node2.nextSibling, node3, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node3.nextSibling, node4, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
assert_equals(node4.nextSibling, null, parentCtor.name + '.append() should update ' +
|
||||
'next sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.nextSibling returns next sibling of this animation node, ' +
|
||||
'several nodes are added by method AnimationGroup.append()');
|
||||
</script>
|
||||
</body>
|
@ -1,54 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode parent attribute tests</title>
|
||||
<meta name="assert" content="The parent animation group of this animation node or null if this animation node does not have a parent animation group">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-parent">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
assert_equals(node.parent, null, type(node) + '.parent should be null');
|
||||
});
|
||||
}, 'AnimationNode.parent is null if animation node does not have a parent animation group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_equals(node.parent, parent, type(node) + '.parent should return ' +
|
||||
'parent animation group of this animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.parent returns parent animation group of this animation node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
var parent = new parentCtor([nodes[0], nodes[1], nodes[2]]);
|
||||
nodes.forEach(function(node) {
|
||||
assert_equals(node.parent, parent, type(node) + '.parent should return ' +
|
||||
'parent animation group of this animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.parent returns parent animation group of this animation node. ' +
|
||||
'The group has several children nodes');
|
||||
|
||||
// The rest is tested in mutator methods: AnimationNode.before(), AnimationNode.after(),
|
||||
// AnimationNode.replace(), AnimationNode.remove(),
|
||||
// AnimationGroup.prepend(), AnimationGroup.append(), AnimationGroup.clone()
|
||||
</script>
|
||||
</body>
|
@ -1,512 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode previousSibling attribute tests</title>
|
||||
<meta name="assert" content="The previous sibling of this animation node">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-previoussibling">
|
||||
<link rel="help" href="http://www.w3.org/TR/dom/#concept-tree-previous-sibling">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var nodes = [
|
||||
newAnimation(createDiv(this)),
|
||||
new AnimationGroup([]),
|
||||
new AnimationSequence([])
|
||||
];
|
||||
nodes.forEach(function(node) {
|
||||
assert_equals(node.previousSibling, null, type(node) + '.previousSibling should be null');
|
||||
});
|
||||
}, 'AnimationNode.previousSibling is null if the node is standalone');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_equals(node.previousSibling, null, type(node) + '.previousSibling ' +
|
||||
'should be null');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling is null if the node is the only child of its parent');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node1) + '.previousSibling should be null');
|
||||
assert_equals(node2.previousSibling, node1, type(node2) + '.previousSibling should return ' +
|
||||
'previous sibling of this animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node. Test first child');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node1) + '.previousSibling should be null');
|
||||
assert_equals(node2.previousSibling, node1, type(node2) + '.previousSibling should return ' +
|
||||
'previous sibling of this animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node. Test second child');
|
||||
|
||||
test(function() {
|
||||
var node1 = newAnimation(createDiv(this));
|
||||
var node2 = newAnimation(createDiv(this));
|
||||
var node3 = newAnimation(createDiv(this));
|
||||
var node4 = newAnimation(createDiv(this));
|
||||
var node5 = newAnimation(createDiv(this));
|
||||
var node6 = newAnimation(createDiv(this));
|
||||
var node7 = new AnimationGroup([node3, node4]);
|
||||
var node8 = new AnimationGroup([node5, node6]);
|
||||
var node9 = newAnimation(createDiv(this));
|
||||
var group = new AnimationGroup([node1, node2, node7, node8, node9]);
|
||||
|
||||
assert_equals(group.previousSibling, null, 'AnimationNode.previousSibling should return ' +
|
||||
'null (root node)');
|
||||
assert_equals(node1.previousSibling, null, 'AnimationNode.previousSibling should return ' +
|
||||
'null for the first node in the group');
|
||||
assert_equals(node2.previousSibling, node1, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node');
|
||||
assert_equals(node3.previousSibling, null, 'AnimationNode.previousSibling should be null ' +
|
||||
'for the first node in the nested group');
|
||||
assert_equals(node4.previousSibling, node3, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (first node in the nested group)');
|
||||
assert_equals(node5.previousSibling, null, 'AnimationNode.previousSibling should be null ' +
|
||||
'for the first node in the second nested group');
|
||||
assert_equals(node6.previousSibling, node5, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (first node in the second nested group)');
|
||||
assert_equals(node7.previousSibling, node2, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (first nested group)');
|
||||
assert_equals(node8.previousSibling, node7, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (second nested group)');
|
||||
assert_equals(node9.previousSibling, node8, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node');
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node. Test ' +
|
||||
'tree structure with AnimationGroup');
|
||||
|
||||
test(function() {
|
||||
var node1 = newAnimation(createDiv(this));
|
||||
var node2 = newAnimation(createDiv(this));
|
||||
var node3 = newAnimation(createDiv(this));
|
||||
var node4 = newAnimation(createDiv(this));
|
||||
var node5 = newAnimation(createDiv(this));
|
||||
var node6 = newAnimation(createDiv(this));
|
||||
var node7 = new AnimationSequence([node3, node4]);
|
||||
var node8 = new AnimationSequence([node5, node6]);
|
||||
var node9 = newAnimation(createDiv(this));
|
||||
var sequence = new AnimationSequence([node1, node2, node7, node8, node9]);
|
||||
|
||||
assert_equals(sequence.previousSibling, null, 'AnimationNode.previousSibling should return ' +
|
||||
'null (root node)');
|
||||
assert_equals(node1.previousSibling, null, 'AnimationNode.previousSibling should return ' +
|
||||
'null for the first node in the group');
|
||||
assert_equals(node2.previousSibling, node1, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node');
|
||||
assert_equals(node3.previousSibling, null, 'AnimationNode.previousSibling should be null ' +
|
||||
'for the first node in the nested group');
|
||||
assert_equals(node4.previousSibling, node3, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (first node in the nested group)');
|
||||
assert_equals(node5.previousSibling, null, 'AnimationNode.previousSibling should be null ' +
|
||||
'for the first node in the second nested group');
|
||||
assert_equals(node6.previousSibling, node5, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (first node in the second nested group)');
|
||||
assert_equals(node7.previousSibling, node2, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (first nested group)');
|
||||
assert_equals(node8.previousSibling, node7, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node (second nested group)');
|
||||
assert_equals(node9.previousSibling, node8, 'AnimationNode.previousSibling should return ' +
|
||||
'previous sibling of this animation node');
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node. Test ' +
|
||||
'tree structure with AnimationSequence');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node2.before(node3);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node1, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, node3, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is changed by method before()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node3) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
node3.before(node1);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node3) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, null, type(node3) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node1, type(node3) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is removed by method before()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = new AnimationGroup([]);
|
||||
var node5 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node2.before(node3, node4, node5);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node1, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node4.previousSibling, node3, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node5.previousSibling, node4, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, node5, type(node2) + '.before() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'several nodes are added by method before()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node1.after(node3);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node1, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, node3, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is changed by method after()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node3) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
node3.after(node1);
|
||||
|
||||
assert_equals(node1.previousSibling, node3, type(node3) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, null, type(node3) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, null, type(node3) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is removed by method after()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = new AnimationGroup([]);
|
||||
var node5 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
node1.after(node3, node4, node5);
|
||||
|
||||
assert_equals(node1.previousSibling, null, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node1, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node4.previousSibling, node3, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node5.previousSibling, node4, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, node5, type(node1) + '.after() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'several nodes are added by method after()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
node2.replace(node4);
|
||||
|
||||
assert_equals(node4.previousSibling, node1, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, null, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node4, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is changed by method replace()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node4) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2, node3]);
|
||||
var parent2 = new parentCtor([node4]);
|
||||
|
||||
node4.replace(node2);
|
||||
|
||||
assert_equals(node3.previousSibling, node1, type(node4) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, null, type(node4) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is removed by method replace()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var node5 = new AnimationGroup([]);
|
||||
var node6 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
node2.replace(node4, node5, node6);
|
||||
|
||||
assert_equals(node4.previousSibling, node1, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node5.previousSibling, node4, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node6.previousSibling, node5, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node6, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, null, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'several nodes are added by method replace()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
node2.remove();
|
||||
|
||||
assert_equals(node3.previousSibling, node1, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, null, type(node2) + '.replace() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is changed by method remove()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.prepend(node2);
|
||||
|
||||
assert_equals(node1.previousSibling, node2, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is changed by method AnimationGroup.prepend()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
parent2.prepend(node1);
|
||||
|
||||
assert_equals(node2.previousSibling, null, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node1, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is removed by method AnimationGroup.prepend()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = new AnimationGroup([]);
|
||||
var node3 = new AnimationSequence([]);
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.prepend(node2, node3, node4);
|
||||
|
||||
assert_equals(node2.previousSibling, null, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node2, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node4.previousSibling, node3, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node1.previousSibling, node4, parentCtor.name + '.prepend() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'several nodes are added by method AnimationGroup.prepend()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.append(node2);
|
||||
|
||||
assert_equals(node1.previousSibling, null, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node2.previousSibling, node1, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is changed by method AnimationGroup.append()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3]);
|
||||
|
||||
parent2.append(node1);
|
||||
|
||||
assert_equals(node2.previousSibling, null, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node1.previousSibling, node3, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'the previous sibling is removed by method AnimationGroup.append()');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = new AnimationGroup([]);
|
||||
var node4 = new AnimationSequence([]);
|
||||
var parent = new parentCtor([node1]);
|
||||
parent.append(node2, node3, node4);
|
||||
|
||||
assert_equals(node2.previousSibling, node1, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node3.previousSibling, node2, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
assert_equals(node4.previousSibling, node3, parentCtor.name + '.append() should update ' +
|
||||
'previous sibling of animation node');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.previousSibling returns previous sibling of this animation node, ' +
|
||||
'several nodes are added by method AnimationGroup.append()');
|
||||
</script>
|
||||
</body>
|
@ -1,240 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode remove() method tests</title>
|
||||
<meta name="assert" content="Removes this animation node from its parent animation group or player">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-remove">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#remove-an-animation-node">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
node.remove();
|
||||
|
||||
assert_equals(node.parent, null, type(node) + ' node parent attribute should be null');
|
||||
});
|
||||
}, 'AnimationNode.remove() does nothing for standalone node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
node.remove();
|
||||
|
||||
assert_array_equals(parent.children, [], type(node) +
|
||||
' node should be removed from the parent ' + parentCtor.name);
|
||||
assert_equals(node.parent, null, type(node) +
|
||||
' node parent attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.remove() removes node from the parent animation group. ' +
|
||||
'Removed node is the only node in the tree');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node1.remove();
|
||||
|
||||
assert_array_equals(parent.children, [node2], type(node1) +
|
||||
' node should be removed from the parent ' + parentCtor.name);
|
||||
assert_equals(parent.firstChild, node2, 'Parent ' + parentCtor.name +
|
||||
' firstChild attribute should be updated');
|
||||
assert_equals(node1.parent, null, 'Removed ' + type(node1) +
|
||||
' node parent attribute should be updated');
|
||||
assert_equals(node1.nextSibling, null, 'Removed ' + type(node1) +
|
||||
' node nextSibling attribute should be updated');
|
||||
assert_equals(node2.previousSibling, null,
|
||||
'Remaining node previousSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.remove() removes node from the parent animation group. ' +
|
||||
'Remove the first node in the group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.remove();
|
||||
|
||||
assert_array_equals(parent.children, [node1], type(node2) +
|
||||
' node should be removed from the parent ' + parentCtor.name);
|
||||
assert_equals(parent.lastChild, node1, 'Parent ' + parentCtor.name +
|
||||
' lastChild attribute should be updated');
|
||||
assert_equals(node2.parent, null, 'Removed ' + type(node2) +
|
||||
' node parent attribute should be updated');
|
||||
assert_equals(node1.nextSibling, null,
|
||||
'Remaining node nextSibling attribute should be updated');
|
||||
assert_equals(node2.previousSibling, null, 'Removed ' + type(node2) +
|
||||
' node previousSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.remove() removes node from the parent animation group. ' +
|
||||
'Remove the last node in the group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
|
||||
node2.remove();
|
||||
|
||||
assert_array_equals(parent.children, [node1, node3], type(node2) +
|
||||
' node should be removed from the parent ' + parentCtor.name);
|
||||
assert_equals(node2.parent, null, 'Removed ' + type(node2) +
|
||||
' node parent attribute should be updated');
|
||||
assert_equals(node2.nextSibling, null, 'Removed ' + type(node2) +
|
||||
' node nextSibling attribute should be updated');
|
||||
assert_equals(node2.previousSibling, null, 'Removed ' + type(node2) +
|
||||
' node previousSibling attribute should be updated');
|
||||
assert_equals(node1.nextSibling, node3,
|
||||
'Remaining node nextSibling attribute should be updated');
|
||||
assert_equals(node3.previousSibling, node1,
|
||||
'Remaining node previousSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.remove() removes node from the parent animation group. ' +
|
||||
'Remove node from the middle of the group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
parents.forEach(function(nodeCtor) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = new nodeCtor([node1, node2]);
|
||||
var node5 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node3, node4, node5]);
|
||||
|
||||
node4.remove();
|
||||
|
||||
assert_array_equals(node4.children, [node1, node2], 'Removed ' +
|
||||
type(node4) + ' node children should not be changed');
|
||||
assert_array_equals(parent.children, [node3, node5], type(node4) +
|
||||
' node should be removed from the parent ' + parentCtor.name);
|
||||
assert_equals(node4.parent, null, 'Removed ' + type(node2) +
|
||||
' node parent attribute should be updated');
|
||||
assert_equals(node4.nextSibling, null, 'Removed ' + type(node2) +
|
||||
' node nextSibling attribute should be updated');
|
||||
assert_equals(node4.previousSibling, null, 'Removed ' + type(node2) +
|
||||
' node previousSibling attribute should be updated');
|
||||
assert_equals(node3.nextSibling, node5,
|
||||
'Remaining node nextSibling attribute should be updated');
|
||||
assert_equals(node5.previousSibling, node3,
|
||||
'Remaining node previousSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test removing a node that has children');
|
||||
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var player = document.timeline.play(node);
|
||||
node.remove();
|
||||
|
||||
assert_equals(player.source, null, type(node) +
|
||||
' node should be disassociated from the player');
|
||||
});
|
||||
}, 'AnimationNode.remove() disassociates the node from player, ' +
|
||||
'if node is directly associated with a player');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
var player = document.timeline.play(parent);
|
||||
|
||||
node2.remove();
|
||||
|
||||
assert_equals(player.source, parent, type(node2) +
|
||||
' parent node should remain associated with the player');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.remove() keeps parent direct association with the player');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
parents.forEach(function(nodeCtor) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var node5 = new parentCtor([node4]);
|
||||
var group1 = new AnimationGroup([node3, node5]);
|
||||
var node6 = newAnimation(createDiv(test));
|
||||
var node7 = new parentCtor([node6]);
|
||||
var node8 = newAnimation(createDiv(test));
|
||||
var sequence1 = new AnimationSequence([node7,node8]);
|
||||
var node9 = new nodeCtor([node1, group1, node2, sequence1]);
|
||||
var node10 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node9, node10]);
|
||||
|
||||
node9.remove();
|
||||
|
||||
assert_equals(node9.parent, null, 'Removed ' + type(node9) +
|
||||
' node parent attribute should be updated');
|
||||
assert_array_equals(node9.children, [node1, group1, node2, sequence1],
|
||||
'Removed ' + type(node9) + ' node children should not be changed');
|
||||
for (var i = 0; i < node9.children.length; i++) {
|
||||
assert_equals(node9.children[i].parent, node9, 'Removed ' + type(node9) +
|
||||
' node children parent attribute should not be changed for child ' + i);
|
||||
}
|
||||
assert_array_equals(group1.children, [node3, node5],
|
||||
'Removed ' + type(node9) + ' node grand children should not be changed');
|
||||
for (var i = 0; i < group1.children.length; i++) {
|
||||
assert_equals(group1.children[i].parent, group1, 'Removed ' + type(node9) +
|
||||
' node grand children parent attribute should not be changed for child ' + i);
|
||||
}
|
||||
assert_array_equals(sequence1.children, [node7,node8],
|
||||
'Removed ' + type(node9) + ' node grand children should not be changed');
|
||||
for (var i = 0; i < sequence1.children.length; i++) {
|
||||
assert_equals(sequence1.children[i].parent, sequence1, 'Removed ' + type(node9) +
|
||||
' node grand children parent attribute should not be changed for child ' + i);
|
||||
}
|
||||
assert_array_equals(node5.children, [node4],
|
||||
'Removed ' + type(node9) + ' node grand children should not be changed');
|
||||
assert_equals(node4.parent, node5, 'Removed ' + type(node9) +
|
||||
' node grand children parent attribute should not be changed');
|
||||
assert_array_equals(node7.children, [node6],
|
||||
'Removed ' + type(node9) + ' node grand children should not be changed');
|
||||
assert_equals(node6.parent, node7, 'Removed ' + type(node9) +
|
||||
' node grand children parent attribute should not be changed');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.remove() on the root of a non-trivial tree does not change child structure');
|
||||
</script>
|
||||
</body>
|
@ -1,445 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode replace() method tests</title>
|
||||
<meta name="assert" content="Replaces this AnimationNode with the passed in nodes parameter">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#dom-animationnode-replace">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#remove-an-animation-node">
|
||||
<link rel="help" href="http://w3c.github.io/web-animations/#insert-children">
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="../testcommon.js"></script>
|
||||
<link rel="stylesheet" href="/resources/testharness.css">
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<script>
|
||||
// Step 1. If there is no parent animation group, terminate these steps.
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
try {
|
||||
node.replace(null);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node) + '.replace(null) throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.replace(null) does nothing if node has no parent animation group');
|
||||
|
||||
test(function() {
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
try {
|
||||
node.replace(node);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node) + '.replace(node) throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.replace() does nothing if node has no parent animation group. ' +
|
||||
'HierarchyRequestError is not thrown if the node is replacing itself');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var nodes = [newAnimation(createDiv(this)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
|
||||
try {
|
||||
node1.replace(node2);
|
||||
} catch(e) {
|
||||
assert_unreached(type(node1) + '.replace() throws unexpected exception: ' + e);
|
||||
}
|
||||
});
|
||||
}, 'AnimationNode.replace() does nothing if node has no parent animation group');
|
||||
|
||||
// Step 2. If any of the animation nodes in nodes is an inclusive ancestor
|
||||
// of the parent animation group throw a HierarchyRequestError exception and terminate these steps.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.replace(node);
|
||||
}, 'HierarchyRequestError should be thrown if ' + type(node) +
|
||||
' replaces itself');
|
||||
assert_equals(node.parent, parent, type(node) + '.replace() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent.children, [node], type(node) + '.replace() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if the node replaces itself');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.replace(parent);
|
||||
}, 'HierarchyRequestError should be thrown if ' + type(node) +
|
||||
' is replaced by its parent ' + parentCtor.name);
|
||||
assert_equals(node.parent, parent, type(node) + '.replace() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent.children, [node], type(node) + '.replace() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if the node is replaced by its parent');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent1 = new parentCtor([node]);
|
||||
var parent2 = new parentCtor([parent1]);
|
||||
var parent3 = new parentCtor([parent2]);
|
||||
var parent4 = new parentCtor([parent3]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node.replace(parent3);
|
||||
}, 'HierarchyRequestError should be thrown if ' + type(node) +
|
||||
' is replaced by its inclusive ancestor' + parentCtor.name);
|
||||
assert_equals(node.parent, parent1, type(node) + '.replace() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent1.children, [node], type(node) + '.replace() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
assert_equals(parent3.parent, parent4, type(node) + '.replace() should not change ' +
|
||||
'parent attribute of replacement node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent4.children, [parent3], type(node) + '.replace() ' +
|
||||
'should not change replacement node parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if the node is replaced by its inclusive ancestor');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var parent1 = new parentCtor([node1]);
|
||||
var parent2 = new parentCtor([parent1]);
|
||||
var parent3 = new parentCtor([parent2]);
|
||||
var parent4 = new parentCtor([parent3]);
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent5 = new parentCtor([node2]);
|
||||
|
||||
assert_throws('HierarchyRequestError', function() {
|
||||
node1.replace(node2, parent3);
|
||||
}, 'HierarchyRequestError should be thrown if ' + type(node1) +
|
||||
' is replaced by its inclusive ancestor' + parentCtor.name);
|
||||
assert_equals(node1.parent, parent1, type(node1) + '.replace() should not change ' +
|
||||
'parent attribute before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent1.children, [node1], type(node1) + '.replace() ' +
|
||||
'should not change parent children before throwing HierarchyRequestError');
|
||||
assert_equals(parent3.parent, parent4, type(node1) + '.replace() should not change ' +
|
||||
'parent attribute of replacement node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent4.children, [parent3], type(node1) + '.replace() ' +
|
||||
'should not change replacement node parent children before throwing HierarchyRequestError');
|
||||
assert_equals(node2.parent, parent5, type(node1) + '.replace() should not change ' +
|
||||
'parent attribute of replacement node before throwing HierarchyRequestError');
|
||||
assert_array_equals(parent5.children, [node2], type(node1) + '.replace() ' +
|
||||
'should not change replacement node parent children before throwing HierarchyRequestError');
|
||||
});
|
||||
});
|
||||
}, 'HierarchyRequestError is thrown if node is replaced by its inclusive ancestor. ' +
|
||||
'Test several arguments in replace() call');
|
||||
|
||||
// Step 3. Let reference child be the next sibling of this animation node not in nodes.
|
||||
// Step 4. Remove this animation node from its parent animation group.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node) {
|
||||
var parent = new parentCtor([node]);
|
||||
|
||||
node.replace();
|
||||
|
||||
assert_array_equals(parent.children, [], type(node) +
|
||||
' node should be removed from parent ' + parentCtor.name);
|
||||
assert_equals(node.parent, null, type(node) +
|
||||
' node parent attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.replace() without arguments removes the node from the parent ' +
|
||||
'animation group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
|
||||
node1.replace(node2);
|
||||
|
||||
assert_array_equals(parent.children, [node2], type(node1) +
|
||||
' node should be removed its parent group');
|
||||
assert_equals(node1.parent, null, type(node1) +
|
||||
' node should be removed from its parent group');
|
||||
assert_equals(node1.previousSibling, null, type(node1) +
|
||||
' node previousSibling attribute should be updated');
|
||||
assert_equals(node1.nextSibling, null, type(node1) +
|
||||
' node nextSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.replace() removes the node from its parent animation group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2, node3]);
|
||||
|
||||
node2.replace(node3);
|
||||
|
||||
assert_array_equals(parent.children, [node1,node3], type(node2) +
|
||||
' node should be removed from parent ' + parentCtor.name);
|
||||
assert_equals(node2.parent, null, type(node2) +
|
||||
' node parent attribute should be updated');
|
||||
assert_equals(node2.nextSibling, null, type(node2) +
|
||||
' node nextSibling attribute should be updated');
|
||||
assert_equals(node2.previousSibling, null, type(node2) +
|
||||
' node previousSibling attribute should be updated');
|
||||
assert_equals(node1.nextSibling, node3,
|
||||
'Sibling node nextSibling attribute should be updated');
|
||||
assert_equals(node3.previousSibling, node1,
|
||||
'Sibling node previousSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.replace(next sibling) removes the node from its parent ' +
|
||||
'animation group');
|
||||
|
||||
// Step 5. Insert nodes before reference child.
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
|
||||
node1.replace(node2);
|
||||
|
||||
assert_array_equals(parent.children, [node2], type(node1) +
|
||||
' node should be replaced');
|
||||
assert_equals(node2.parent, parent,
|
||||
'Replacement node should be assigned to a parent group');
|
||||
});
|
||||
});
|
||||
}, 'AnimationNode.replace() replaces node in the parent animation group');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node4) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3, parent1, node4]);
|
||||
|
||||
node4.replace(node1);
|
||||
|
||||
assert_array_equals(parent1.children, [node2],
|
||||
'Replacement node should be removed from its previous position in the tree');
|
||||
assert_array_equals(parent2.children, [node3, parent1, node1],
|
||||
'Replacement node should be inserted into the new position');
|
||||
assert_equals(node1.parent, parent2, 'Inserted node parent group should be assigned');
|
||||
assert_equals(node1.previousSibling, parent1,
|
||||
'Inserted node previousSibling attribute should be updated');
|
||||
assert_equals(node1.nextSibling, null,
|
||||
'Inserted node nextSibling attribute should be updated');
|
||||
|
||||
assert_equals(node4.parent, null, 'Node should be removed from its parent group');
|
||||
assert_equals(node4.previousSibling, null,
|
||||
'Replaced node previousSibling attribute should be updated');
|
||||
assert_equals(node4.nextSibling, null,
|
||||
'Replaced node nextSibling attribute should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.replace() replaces given node. The previous position ' +
|
||||
'of the replacement node is deeper in the tree than the current node');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent1 = new parentCtor([node1, node2]);
|
||||
var parent2 = new parentCtor([node3, parent1, node4]);
|
||||
|
||||
node2.replace(node4);
|
||||
|
||||
assert_array_equals(parent1.children, [node1, node4],
|
||||
'Replacement node should be inserted to the new position');
|
||||
assert_array_equals(parent2.children, [node3, parent1],
|
||||
'Replacement node should be removed from its previous position in the tree');
|
||||
assert_equals(node4.parent, parent1, 'Inserted node parent group should be changed');
|
||||
assert_equals(node4.previousSibling, node1,
|
||||
'Inserted node previousSibling attribute should be updated');
|
||||
assert_equals(node1.nextSibling, node4,
|
||||
'Inserted node sibling nextSibling attribute should be updated');
|
||||
|
||||
assert_equals(node2.parent, null, 'Replaced node parent group should be changed');
|
||||
assert_equals(node2.previousSibling, null,
|
||||
'Replaced node previousSibling attribute should be updated');
|
||||
assert_equals(node2.nextSibling, null, 'Replaced node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.replace() replaces given node. The previous position ' +
|
||||
'of the replacement node is shallower in the tree than current node, but is not an ancestor');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.replace(node3, node4);
|
||||
|
||||
assert_array_equals(parent.children, [node1, node3, node4], type(node2) + '.replace() ' +
|
||||
'should replace the current node by ones passed in arguments');
|
||||
assert_equals(node1.nextSibling, node3, 'nextSibling attribute should be updated');
|
||||
assert_equals(node3.previousSibling, node1, 'Inserted node previousSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node3.nextSibling, node4, 'Inserted node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node3, 'Inserted node previousSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node4.nextSibling, null, 'Inserted node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the second inserted node ' +
|
||||
'should be changed');
|
||||
assert_equals(node2.parent, null, 'Replaced node parent group should be changed');
|
||||
assert_equals(node2.previousSibling, null,
|
||||
'Replaced node previousSibling attribute should be updated');
|
||||
assert_equals(node2.nextSibling, null, 'Replaced node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.replace() replaces given node. Test several arguments');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.replace(node3, node4, node3, node4);
|
||||
|
||||
assert_array_equals(parent.children, [node1, node3, node4], type(node2) + '.replace() ' +
|
||||
'should replace the current node by ones passed in arguments');
|
||||
assert_equals(node1.nextSibling, node3, 'nextSibling attribute should be updated');
|
||||
assert_equals(node3.previousSibling, node1, 'Inserted node previousSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node3.nextSibling, node4, 'Inserted node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node4.previousSibling, node3, 'Inserted node previousSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node4.nextSibling, null, 'Inserted node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the second inserted node ' +
|
||||
'should be changed');
|
||||
assert_equals(node2.parent, null, 'Replaced node parent group should be changed');
|
||||
assert_equals(node2.previousSibling, null,
|
||||
'Replaced node previousSibling attribute should be updated');
|
||||
assert_equals(node2.nextSibling, null, 'Replaced node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.replace() replaces given node by several nodes, duplicate nodes are ignored');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node2) {
|
||||
var node1 = newAnimation(createDiv(test));
|
||||
var node3 = newAnimation(createDiv(test));
|
||||
var node4 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1, node2]);
|
||||
|
||||
node2.replace(node3, node4, node3);
|
||||
|
||||
assert_array_equals(parent.children, [node1, node4, node3], type(node2) + '.replace() ' +
|
||||
'should replace the current node by ones passed in arguments');
|
||||
assert_equals(node1.nextSibling, node4, 'nextSibling attribute should be updated');
|
||||
assert_equals(node4.previousSibling, node1, 'Inserted node previousSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node4.nextSibling, node3, 'Inserted node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node4.parent, parent, 'Parent group of the inserted node should be changed');
|
||||
assert_equals(node3.previousSibling, node4, 'Inserted node previousSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node3.nextSibling, null, 'Inserted node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
assert_equals(node3.parent, parent, 'Parent group of the second inserted node ' +
|
||||
'should be changed');
|
||||
assert_equals(node2.parent, null, 'Replaced node parent group should be changed');
|
||||
assert_equals(node2.previousSibling, null,
|
||||
'Replaced node previousSibling attribute should be updated');
|
||||
assert_equals(node2.nextSibling, null, 'Replaced node nextSibling attribute ' +
|
||||
'should be updated');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.replace() replaces given node by several nodes, check replacement order');
|
||||
|
||||
test(function() {
|
||||
var test = this;
|
||||
var parents = [AnimationGroup, AnimationSequence];
|
||||
parents.forEach(function(parentCtor) {
|
||||
var nodes = [newAnimation(createDiv(test)), new AnimationGroup([]), new AnimationSequence([])];
|
||||
nodes.forEach(function(node1) {
|
||||
var node2 = newAnimation(createDiv(test));
|
||||
var parent = new parentCtor([node1]);
|
||||
var player = document.timeline.play(node2);
|
||||
|
||||
assert_equals(player.source, node2, 'The node should be associated with its player');
|
||||
node1.replace(node2);
|
||||
assert_equals(player.source, null, 'The node should be disassociated from its player');
|
||||
});
|
||||
});
|
||||
}, 'Test AnimationNode.replace() disassociates the inserted node from the player, ' +
|
||||
'if node is directly associated with a player');
|
||||
</script>
|
||||
</body>
|
@ -1,54 +0,0 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>AnimationNode IDL tests</title>
|
||||
<link rel="author" title="Sergey G. Grekhov" href="mailto:sgrekhov@unipro.ru">
|
||||
<link rel="author" title="Aleksei Yu. Semenov" href="mailto:a.semenov@unipro.ru">
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script src="/resources/WebIDLParser.js"></script>
|
||||
<script src="/resources/idlharness.js"></script>
|
||||
<body>
|
||||
<div id="log"></div>
|
||||
<div id="target"></div>
|
||||
<script type="text/plain" id="untested-IDL">
|
||||
interface AnimationPlayer {
|
||||
};
|
||||
|
||||
interface AnimationTiming {
|
||||
};
|
||||
|
||||
interface ComputedTimingProperties {
|
||||
};
|
||||
|
||||
interface AnimationGroup {
|
||||
};
|
||||
</script>
|
||||
<script type="text/plain" id="AnimationNode-IDL">
|
||||
interface AnimationNode {
|
||||
// Timing
|
||||
readonly attribute AnimationTiming timing;
|
||||
readonly attribute ComputedTimingProperties computedTiming;
|
||||
|
||||
// Timing hierarchy
|
||||
readonly attribute AnimationGroup? parent;
|
||||
readonly attribute AnimationNode? previousSibling;
|
||||
readonly attribute AnimationNode? nextSibling;
|
||||
void before (AnimationNode... nodes);
|
||||
void after (AnimationNode... nodes);
|
||||
void replace (AnimationNode... nodes);
|
||||
void remove ();
|
||||
};
|
||||
</script>
|
||||
<script>
|
||||
'use strict';
|
||||
|
||||
var target = document.getElementById('target');
|
||||
var node = new Animation(target, [], 5);
|
||||
|
||||
var idlArray = new IdlArray();
|
||||
idlArray.add_untested_idls(document.getElementById('untested-IDL').textContent);
|
||||
idlArray.add_idls(document.getElementById('AnimationNode-IDL').textContent);
|
||||
idlArray.add_objects( { AnimationNode: ['node'] } );
|
||||
idlArray.test();
|
||||
</script>
|
||||
</body>
|
@ -10,29 +10,6 @@ policies and contribution forms [3].
|
||||
|
||||
"use strict";
|
||||
|
||||
var ANIMATION_END_TIME = 1000;
|
||||
var ANIMATION_TOP_DEFAULT = 300;
|
||||
var ANIMATION_TOP_0 = 10;
|
||||
var ANIMATION_TOP_0_5 = 100;
|
||||
var ANIMATION_TOP_1 = 200;
|
||||
|
||||
var KEYFRAMES = [ {
|
||||
top : ANIMATION_TOP_0 + 'px',
|
||||
offset : 0
|
||||
}, {
|
||||
top : ANIMATION_TOP_0_5 + 'px',
|
||||
offset : 1 / 2
|
||||
}, {
|
||||
top : ANIMATION_TOP_1 + 'px',
|
||||
offset : 1
|
||||
} ];
|
||||
|
||||
// creates new animation for given target
|
||||
function newAnimation(animationTarget) {
|
||||
animationTarget.style.top = ANIMATION_TOP_DEFAULT + 'px';
|
||||
return new Animation(animationTarget, KEYFRAMES, ANIMATION_END_TIME);
|
||||
}
|
||||
|
||||
// creates div element, appends it to the document body and
|
||||
// removes the created element during test cleanup
|
||||
function createDiv(test, doc) {
|
||||
@ -91,11 +68,6 @@ function createPseudo(test, type) {
|
||||
return anim.effect.target;
|
||||
}
|
||||
|
||||
// Returns the type name of given object
|
||||
function type(object) {
|
||||
return Object.prototype.toString.call(object).slice(8, -1);
|
||||
}
|
||||
|
||||
// Convert px unit value to a Number
|
||||
function pxToNum(str) {
|
||||
return Number(String(str).match(/^(-?[\d.]+)px$/)[1]);
|
||||
|
Loading…
Reference in New Issue
Block a user