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

Side by Side Diff: third_party/WebKit/LayoutTests/imported/web-platform-tests/dom/nodes/append-on-Document.html

Issue 1529523002: Import dom/ from web-platform-tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tweak W3CImportExpectations Created 5 years 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 <meta charset=utf-8>
3 <title>DocumentType.append</title>
4 <link rel=help href="https://dom.spec.whatwg.org/#dom-parentnode-append">
5 <script src="../../../../resources/testharness.js"></script>
6 <script src="../../../../resources/testharnessreport.js"></script>
7 <script>
8
9 function test_append_on_Document() {
10
11 var node = document.implementation.createDocument(null, null);
12 test(function() {
13 var parent = node.cloneNode();
14 parent.append();
15 assert_array_equals(parent.childNodes, []);
16 }, 'Document.append() without any argument, on a Document having no child.') ;
17
18 test(function() {
19 var parent = node.cloneNode();
20 var x = document.createElement('x');
21 parent.append(x);
22 assert_array_equals(parent.childNodes, [x]);
23 }, 'Document.append() with only one element as an argument, on a Document ha ving no child.');
24
25 test(function() {
26 var parent = node.cloneNode();
27 var x = document.createElement('x');
28 var y = document.createElement('y');
29 parent.appendChild(x);
30 assert_throws('HierarchyRequestError', function() { parent.append(y); }) ;
31 assert_array_equals(parent.childNodes, [x]);
32 }, 'Document.append() with only one element as an argument, on a Document ha ving one child.');
33
34 test(function() {
35 var parent = node.cloneNode();
36 assert_throws('HierarchyRequestError', function() { parent.append('text' ); });
37 assert_array_equals(parent.childNodes, []);
38 }, 'Document.append() with text as an argument, on a Document having no chil d.');
39
40 test(function() {
41 var parent = node.cloneNode();
42 var x = document.createElement('x');
43 var y = document.createElement('y');
44 assert_throws('HierarchyRequestError', function() { parent.append(x, y); });
45 assert_array_equals(parent.childNodes, []);
46 }, 'Document.append() with two elements as the argument, on a Document havin g no child.');
47
48 }
49
50 test_append_on_Document();
51
52 </script>
53 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698