OLD | NEW |
1 function testRemove(node, parent, type) { | 1 function testRemove(node, parent, type) { |
2 test(function() { | 2 test(function() { |
3 assert_true("remove" in node); | 3 assert_true("remove" in node); |
4 assert_equals(typeof node.remove, "function"); | 4 assert_equals(typeof node.remove, "function"); |
5 assert_equals(node.remove.length, 0); | 5 assert_equals(node.remove.length, 0); |
6 }, type + " should support remove()"); | 6 }, type + " should support remove()"); |
7 test(function() { | 7 test(function() { |
8 assert_equals(node.parentNode, null, "Node should not have a parent"); | 8 assert_equals(node.parentNode, null, "Node should not have a parent"); |
9 assert_equals(node.remove(), undefined); | 9 assert_equals(node.remove(), undefined); |
10 assert_equals(node.parentNode, null, "Removed new node should not have a par
ent"); | 10 assert_equals(node.parentNode, null, "Removed new node should not have a par
ent"); |
(...skipping 10 matching lines...) Expand all Loading... |
21 assert_equals(node.parentNode, null, "Node should not have a parent"); | 21 assert_equals(node.parentNode, null, "Node should not have a parent"); |
22 var before = parent.appendChild(document.createComment("before")); | 22 var before = parent.appendChild(document.createComment("before")); |
23 parent.appendChild(node); | 23 parent.appendChild(node); |
24 var after = parent.appendChild(document.createComment("after")); | 24 var after = parent.appendChild(document.createComment("after")); |
25 assert_equals(node.parentNode, parent, "Appended node should have a parent")
; | 25 assert_equals(node.parentNode, parent, "Appended node should have a parent")
; |
26 assert_equals(node.remove(), undefined); | 26 assert_equals(node.remove(), undefined); |
27 assert_equals(node.parentNode, null, "Removed node should not have a parent"
); | 27 assert_equals(node.parentNode, null, "Removed node should not have a parent"
); |
28 assert_array_equals(parent.childNodes, [before, after], "Parent should have
two children left"); | 28 assert_array_equals(parent.childNodes, [before, after], "Parent should have
two children left"); |
29 }, "remove() should work if " + type + " does have a parent and siblings"); | 29 }, "remove() should work if " + type + " does have a parent and siblings"); |
30 } | 30 } |
OLD | NEW |