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

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(node, nodeName) {
7 var child;
8 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.
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 = node.cloneNode();
22 parent.appendChild(child);
23 child.after();
24 expected = innerHtml;
25 assert_equals(parent.innerHTML, expected);
26 }, 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'.
27
28 test(function() {
29 var parent = node.cloneNode();
30 parent.appendChild(child);
31 child.after(null);
32 expected = innerHtml + 'null';
33 assert_equals(parent.innerHTML, expected);
34 }, nodeName + '.after() with null as an argument.');
35
36 test(function() {
37 var parent = node.cloneNode();
38 parent.appendChild(child);
39 child.after('text');
40 expected = innerHtml + 'text';
41 assert_equals(parent.innerHTML, expected);
42 }, nodeName + '.after() with only text as an argument.');
43
44 test(function() {
45 var parent = node.cloneNode();
46 var x = document.createElement('x');
47 parent.appendChild(child);
48 child.after(x);
49 expected = innerHtml + '<x></x>';
50 assert_equals(parent.innerHTML, expected);
51 }, nodeName + '.after() with only one element as an argument.');
52
53 test(function() {
54 var parent = node.cloneNode();
55 var x = document.createElement('x');
56 parent.appendChild(child);
57 child.after(x, 'text');
58 expected = innerHtml + '<x></x>text';
59 assert_equals(parent.innerHTML, expected);
60 }, 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.
61 }
62
63 test_after(document.createElement('div'), 'Comment');
64 test_after(document.createElement('div'), 'Element');
65 test_after(document.createElement('div'), 'Text');
66
67 </script>
68 </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