Index: LayoutTests/fast/dom/ChildNode/after.html |
diff --git a/LayoutTests/fast/dom/ChildNode/after.html b/LayoutTests/fast/dom/ChildNode/after.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3f5c251f1b7a4e06e0968d1f90ddc4bba4644b18 |
--- /dev/null |
+++ b/LayoutTests/fast/dom/ChildNode/after.html |
@@ -0,0 +1,84 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script> |
+ |
+test(function() { |
+ var node = document.createComment('node'); |
+ assert_true('after' in node); |
+ assert_equals(typeof node.after, 'function'); |
+ assert_equals(node.after.length, 0); |
philipj_slow
2015/06/09 12:48:31
This makes me thing that after() can be called wit
Paritosh Kumar
2015/06/12 15:55:36
Thanks. Updated.
|
+}, "Comment should support after()"); |
philipj_slow
2015/06/09 12:48:31
This and the following tests are on the same form,
Paritosh Kumar
2015/06/12 15:55:37
Done.
|
+ |
+test(function() { |
+ var node = document.createElement('node'); |
+ assert_true('after' in node); |
+ assert_equals(typeof node.after, 'function'); |
+ assert_equals(node.after.length, 0); |
+}, "Element should support after()"); |
+ |
+test(function() { |
+ var node = document.createTextNode('node'); |
+ assert_true('after' in node); |
+ assert_equals(typeof node.after, 'function'); |
+ assert_equals(node.after.length, 0); |
+}, "Text should support after()"); |
+ |
+test(function() { |
+ var parent = document.createElement('div'); |
+ var test = document.createComment('test'); |
+ parent.appendChild(test); |
+ var x = document.createComment('x'); |
+ var z = document.createComment('z'); |
+ |
+ test.after(x, 'y', z); |
+ |
+ assert_equals(parent.childNodes.length, 4, 'parent should have 4 children'); |
philipj_slow
2015/06/09 12:48:31
I think you could write these assertions using tes
Paritosh Kumar
2015/06/12 15:55:37
Done.
|
+ assert_equals(parent.firstChild, test, 'parent\'s first child should be test'); |
+ assert_equals(parent.childNodes[1], x, 'parent\'s second child should be x'); |
+ assert_equals(parent.childNodes[2].data, 'y', 'parent\'s third child should be "y"'); |
+ assert_equals(parent.lastChild, z, 'parent\'s last child should be z'); |
+ |
+ z.after('a'); |
+ assert_equals(parent.lastChild.data, 'a', 'parent\'s third child should be "a"'); |
+}, "after() should work for Comment"); |
+ |
+test(function() { |
+ var parent = document.createElement('div'); |
+ var test = document.createElement('test'); |
+ parent.appendChild(test); |
+ var x = document.createElement('x'); |
+ var z = document.createElement('z'); |
+ |
+ test.after(x, 'y', z); |
+ |
+ assert_equals(parent.childNodes.length, 4, 'parent should have 4 children'); |
+ assert_equals(parent.firstChild, test, 'parent\'s first child should be test'); |
+ assert_equals(parent.childNodes[1], x, 'parent\'s second child should be x'); |
+ assert_equals(parent.childNodes[2].data, 'y', 'parent\'s third child should be "y"'); |
+ assert_equals(parent.lastChild, z, 'parent\'s last child should be z'); |
+ |
+ z.after('a'); |
+ assert_equals(parent.lastChild.data, 'a', 'parent\'s third child should be "a"'); |
+}, "after() should work for Element"); |
+ |
+test(function() { |
+ var parent = document.createElement('div'); |
+ var test = document.createTextNode('test'); |
+ parent.appendChild(test); |
+ var x = document.createTextNode('x'); |
+ var z = document.createTextNode('z'); |
+ |
+ test.after(x, 'y', z); |
+ |
+ assert_equals(parent.childNodes.length, 4, 'parent should have 4 children'); |
+ assert_equals(parent.firstChild, test, 'parent\'s first child should be test'); |
+ assert_equals(parent.childNodes[1], x, 'parent\'s second child should be x'); |
+ assert_equals(parent.childNodes[2].data, 'y', 'parent\'s third child should be "y"'); |
+ assert_equals(parent.lastChild, z, 'parent\'s last child should be z'); |
+ |
+ z.after('a'); |
+ assert_equals(parent.lastChild.data, 'a', 'parent\'s third child should be "a"'); |
+}, "after() should work for Text"); |
+</script> |
+</html> |