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..73540dbdeab09e787c74aeb0c5ed2f1bc2405c9c |
--- /dev/null |
+++ b/LayoutTests/fast/dom/ChildNode/after.html |
@@ -0,0 +1,68 @@ |
+<!DOCTYPE html> |
+<script src="../../../resources/testharness.js"></script> |
+<script src="../../../resources/testharnessreport.js"></script> |
+<script> |
+ |
+function test_after(node, nodeName) { |
+ var child; |
+ var innerHtml; |
philipj_slow
2015/06/12 16:12:33
Maybe capitalize as innerHTML to match the API.
Paritosh Kumar
2015/06/15 08:55:23
Done.
|
+ if (nodeName == 'Comment') { |
+ child = document.createComment('test'); |
+ innerHtml = '<!--test-->'; |
+ } else if (nodeName == 'Element') { |
+ child = document.createElement('test'); |
+ innerHtml = '<test></test>'; |
+ } else { |
+ child = document.createTextNode('test'); |
+ innerHtml = 'test'; |
+ } |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ parent.appendChild(child); |
+ child.after(); |
+ expected = innerHtml; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.after() with empty argument.'); |
philipj_slow
2015/06/12 16:12:33
s/empty/no/ to distinguish it from an empty string
Paritosh Kumar
2015/06/15 08:55:23
Thanks. Using 'without any argument'.
|
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ parent.appendChild(child); |
+ child.after(null); |
+ expected = innerHtml + 'null'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.after() with null as an argument.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ parent.appendChild(child); |
+ child.after('text'); |
+ expected = innerHtml + 'text'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.after() with only text as an argument.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ var x = document.createElement('x'); |
+ parent.appendChild(child); |
+ child.after(x); |
+ expected = innerHtml + '<x></x>'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.after() with only one element as an argument.'); |
+ |
+ test(function() { |
+ var parent = node.cloneNode(); |
+ var x = document.createElement('x'); |
+ parent.appendChild(child); |
+ child.after(x, 'text'); |
+ expected = innerHtml + '<x></x>text'; |
+ assert_equals(parent.innerHTML, expected); |
+ }, nodeName + '.after() with only one element and text as argument.'); |
philipj_slow
2015/06/12 16:12:33
I think drop the "only" in the name of this test.
Paritosh Kumar
2015/06/15 08:55:23
Yeah. Thanks.
|
+} |
+ |
+test_after(document.createElement('div'), 'Comment'); |
+test_after(document.createElement('div'), 'Element'); |
+test_after(document.createElement('div'), 'Text'); |
+ |
+</script> |
+</html> |