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

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, 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 unified diff | Download patch
« no previous file with comments | « no previous file | LayoutTests/fast/dom/ChildNode/before.html » ('j') | Source/core/dom/Node.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.');
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 parent.appendChild(y);
66 parent.appendChild(child);
67 parent.appendChild(x);
68 child.after(x, y, "text");
69 var expected = innerHTML + '<x></x><y></y>text';
70 assert_equals(parent.innerHTML, expected);
71 }, nodeName + '.after() with argument containing sibling of childNode and te xt as arguments.');
72
73 test(function() {
74 var x = document.createElement('x');
75 var y = document.createElement('y');
76 x.after(y);
77 assert_equals(x.nextSibling, null);
78 }, nodeName + '.after() on a child without any parent.');
79 }
80
81 test_after('Comment');
82 test_after('Element');
83 test_after('Text');
84
85 </script>
86 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/ChildNode/before.html » ('j') | Source/core/dom/Node.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698