Index: LayoutTests/fast/dom/script-tests/childnode-after.js |
diff --git a/LayoutTests/fast/dom/script-tests/childnode-after.js b/LayoutTests/fast/dom/script-tests/childnode-after.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..84710ce46a0de71c9b620510156028f4abc67c54 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/script-tests/childnode-after.js |
@@ -0,0 +1,29 @@ |
+function testAfter(node, parent, type) { |
+test(function() { |
+assert_true("after" in node); |
+assert_equals(typeof node.after, "function"); |
+assert_equals(node.after.length, 0); |
+}, type + " should support after()"); |
+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"); |
+node.after(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"); |
+}, "after() should work for " + type); |
+} |