Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Unified Diff: LayoutTests/fast/dom/ChildNode/after.html

Issue 1085843002: Implement DOM: prepend, append, before, after & replaceWith (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/ChildNode/before.html » ('j') | Source/core/dom/ChildNode.idl » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
« no previous file with comments | « no previous file | LayoutTests/fast/dom/ChildNode/before.html » ('j') | Source/core/dom/ChildNode.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698