Chromium Code Reviews| 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..a8d7b09ac93773d0c2a608ea09f74e39b9c5903d |
| --- /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; |
| + 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() 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.'); |
|
philipj_slow
2015/06/15 10:06:58
A test with an empty string would also be good, to
|
| + |
| + 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 one element and text as arguments.'); |
| +} |
| + |
| +test_after(document.createElement('div'), 'Comment'); |
|
philipj_slow
2015/06/15 10:06:58
I see that each test uses a new div, so you could
Paritosh Kumar
2015/06/23 13:32:08
Done.
|
| +test_after(document.createElement('div'), 'Element'); |
| +test_after(document.createElement('div'), 'Text'); |
| + |
| +</script> |
| +</html> |