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

Side by Side Diff: LayoutTests/fast/dom/ParentNode/prepend-on-document.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_prepend_on_Document() {
7
8 var node = document.implementation.createDocument(null, null);
9 test(function() {
10 var parent = node.cloneNode();
11 parent.prepend();
12 assert_array_equals(parent.childNodes, []);
13 }, 'Document.prepend() without any argument, on a Document having no child.' );
14
15 test(function() {
16 var parent = node.cloneNode();
17 var x = document.createElement('x');
18 parent.prepend(x);
19 assert_array_equals(parent.childNodes, [x]);
20 }, 'Document.prepend() with only one element as an argument, on a Document h aving no child.');
21
22 test(function() {
23 var parent = node.cloneNode();
24 var x = document.createElement('x');
25 var y = document.createElement('y');
26 parent.appendChild(x);
27 assert_throws('HierarchyRequestError', function() { parent.prepend(y); } );
28 assert_array_equals(parent.childNodes, [x]);
29 }, 'Document.append() with only one element as an argument, on a Document ha ving one child.');
30
31 test(function() {
32 var parent = node.cloneNode();
33 assert_throws('HierarchyRequestError', function() { parent.prepend('text '); });
34 assert_array_equals(parent.childNodes, []);
35 }, 'Document.prepend() with text as an argument, on a Document having no chi ld.');
36
37 test(function() {
38 var parent = node.cloneNode();
39 var x = document.createElement('x');
40 var y = document.createElement('y');
41 assert_throws('HierarchyRequestError', function() { parent.prepend(x, y) ; });
42 assert_array_equals(parent.childNodes, []);
43 }, 'Document.prepend() with two elements as the argument, on a Document havi ng no child.');
44
45 }
46
47 test_prepend_on_Document();
48
49 </script>
50 </html>
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/ParentNode/prepend.html ('k') | LayoutTests/webexposed/element-instance-property-listing-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698