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

Side by Side 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, 5 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <script src="../../../resources/testharness.js"></script>
3 <script src="../../../resources/testharnessreport.js"></script>
4 <script>
5
6 function test_after(nodeName) {
7 var child;
8 var innerHTML;
9 if (nodeName == 'Comment') {
10 child = document.createComment('test');
11 innerHTML = '<!--test-->';
12 } else if (nodeName == 'Element') {
13 child = document.createElement('test');
14 innerHTML = '<test></test>';
15 } else {
16 child = document.createTextNode('test');
17 innerHTML = 'test';
18 }
19
20 test(function() {
21 var parent = document.createElement('div');
22 parent.appendChild(child);
23 child.after();
24 assert_equals(parent.innerHTML, innerHTML);
25 }, nodeName + '.after() without any argument.');
26
27 test(function() {
28 var parent = document.createElement('div');
29 parent.appendChild(child);
30 child.after(null);
31 var expected = innerHTML + 'null';
32 assert_equals(parent.innerHTML, expected);
33 }, nodeName + '.after() with null as an argument.');
philipj_slow 2015/07/03 21:52:05 after() with the empty string as an argument would
Paritosh Kumar 2015/07/06 09:02:26 Done.
34
35 test(function() {
36 var parent = document.createElement('div');
37 parent.appendChild(child);
38 child.after('text');
39 var expected = innerHTML + 'text';
40 assert_equals(parent.innerHTML, expected);
41 }, nodeName + '.after() with only text as an argument.');
42
43 test(function() {
44 var parent = document.createElement('div');
45 var x = document.createElement('x');
46 parent.appendChild(child);
47 child.after(x);
48 var expected = innerHTML + '<x></x>';
49 assert_equals(parent.innerHTML, expected);
50 }, nodeName + '.after() with only one element as an argument.');
51
52 test(function() {
53 var parent = document.createElement('div');
54 var x = document.createElement('x');
55 parent.appendChild(child);
56 child.after(x, 'text');
57 var expected = innerHTML + '<x></x>text';
58 assert_equals(parent.innerHTML, expected);
59 }, nodeName + '.after() with one element and text as arguments.');
60
61 test(function() {
62 var parent = document.createElement('div');
63 var x = document.createElement('x');
64 var y = document.createElement('y');
65 var z = document.createElement('z');
66 parent.appendChild(y);
67 parent.appendChild(child);
68 parent.appendChild(x);
69 child.after(x, y, z);
70 var expected = innerHTML + '<x></x><y></y><z></z>';
71 assert_equals(parent.innerHTML, expected);
72 }, nodeName + '.after() containing sibling of child as arguments.');
philipj_slow 2015/07/03 21:52:05 In before.html the equivalent test is called '.bef
Paritosh Kumar 2015/07/06 09:02:27 Done.
philipj_slow 2015/07/06 12:02:40 Oh, it should be a plural "siblings" here and in t
73
74 test(function() {
75 var parent = document.createElement('div');
76 var x = document.createElement('x');
77 var y = document.createElement('y');
78 parent.appendChild(child);
79 parent.appendChild(x);
80 parent.appendChild(document.createTextNode('text'));
81 parent.appendChild(y);
82 child.after(x, 'text');
83 var expected = innerHTML + '<x></x>texttext<y></y>';
84 assert_equals(parent.innerHTML, expected);
85 }, nodeName + '.after() with one sibling of child and text as arguments.');
philipj_slow 2015/07/03 21:52:05 A test that includes the context object itself as
Paritosh Kumar 2015/07/06 09:02:27 Done.
86
87 test(function() {
88 var x = document.createElement('x');
89 var y = document.createElement('y');
90 x.after(y);
91 assert_equals(x.nextSibling, null);
92 }, nodeName + '.after() on a child without any parent.');
93 }
94
95 test_after('Comment');
96 test_after('Element');
97 test_after('Text');
98
99 </script>
100 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/ChildNode/before.html » ('j') | LayoutTests/fast/dom/ChildNode/before.html » ('J')

Powered by Google App Engine
This is Rietveld 408576698