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

Side by Side Diff: LayoutTests/fast/dom/ParentNode/prepend.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
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_prepend(node, nodeName) {
7
8 test(function() {
9 var parent = node.cloneNode();
10 parent.prepend();
11 expected = "";
12 assert_equals(parent.innerHTML, expected);
13 }, nodeName + '.prepend() without any argument, on a parent having no child. ');
14
15 test(function() {
16 var parent = node.cloneNode();
17 parent.prepend(null);
18 expected = 'null';
19 assert_equals(parent.innerHTML, expected);
20 }, nodeName + '.prepend() with null as an argument, on a parent having no ch ild.');
21
22 test(function() {
23 var parent = node.cloneNode();
24 parent.prepend('text');
25 expected = 'text';
26 assert_equals(parent.innerHTML, expected);
27 }, nodeName + '.prepend() with only text as an argument, on a parent having no child.');
28
29 test(function() {
30 var parent = node.cloneNode();
31 var x = document.createElement('x');
32 parent.prepend(x);
33 expected = '<x></x>';
34 assert_equals(parent.innerHTML, expected);
35 }, nodeName + '.prepend() with only one element as an argument, on a parent having no child.');
36
37 test(function() {
38 var parent = node.cloneNode();
39 var child = document.createElement('test');
40 parent.appendChild(child);
41 parent.prepend(null);
42 expected = 'null<test></test>';
43 assert_equals(parent.innerHTML, expected);
44 }, nodeName + '.prepend() with null as an argument, on a parent having a ch ild.');
45
46 test(function() {
47 var parent = node.cloneNode();
48 var x = document.createElement('x');
49 var child = document.createElement('test');
50 parent.appendChild(child);
51 parent.prepend(x, 'text');
52 expected = '<x></x>text<test></test>';
53 assert_equals(parent.innerHTML, expected);
54 }, nodeName + '.prepend() with one element and text as argument, on a parent having a child.');
55 }
56
57 test_prepend(document.createElement('div'), 'Element');
58
59 </script>
60 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698