Index: LayoutTests/fast/dom/script-tests/parentnode-append.js |
diff --git a/LayoutTests/fast/dom/script-tests/parentnode-append.js b/LayoutTests/fast/dom/script-tests/parentnode-append.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..176325ad2f947497efcbe9a212f2e3f90f045e06 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/script-tests/parentnode-append.js |
@@ -0,0 +1,29 @@ |
+function testAppend(node, parent, type) { |
+test(function() { |
+assert_true("append" in parent); |
+assert_equals(typeof parent.append, "function"); |
+assert_equals(parent.append.length, 0); |
+}, type + " should support append()"); |
+test(function() { |
+var x, y; |
+if (type == 'element' || type == 'document-fragment') { |
+ x = document.createElement('x'); |
+ y = document.createElement('y'); |
+} |
+if (type == 'comment') { |
+ x = document.createComment('x'); |
+ y = document.createComment('y'); |
+} |
+if (type == 'text') { |
+ x = document.createTextNode('x'); |
+ y = document.createTextNode('y'); |
+} |
+parent.appendChild(node); |
+assert_equals(node.parentNode, parent, "Appended node should have a parent"); |
+parent.append(x, y, 'z'); |
+assert_equals(parent.childNodes.length, 4, "Parent should have 4 children"); |
+assert_equals(parent.firstChild, node, "Parent's first child should be node"); |
+assert_equals(parent.childNodes[1], x, "Parent's second child should be x"); |
+assert_equals(parent.lastChild.data, 'z', "Parent's last child's data should be z"); |
+}, "append() should work for " + type); |
+} |