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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/tabular-data/the-table-element/createTBody.html

Issue 1144143009: W3C Test: Import web-platform-tests/html/semantics (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
OLDNEW
(Empty)
1 <!doctype html>
2 <meta charset=utf-8>
3 <title>HTMLTableElement.createTBody</title>
4 <script src=../../../../../../resources/testharness.js></script>
5 <script src=../../../../../../resources/testharnessreport.js></script>
6 <div id=log></div>
7 <script>
8 function assert_tbody(tbody) {
9 assert_equals(tbody.localName, "tbody");
10 assert_equals(tbody.namespaceURI, htmlNS);
11 assert_equals(tbody.prefix, null);
12 }
13 var htmlNS = "http://www.w3.org/1999/xhtml";
14 test(function() {
15 var table = document.createElement("table");
16 var tbody = table.createTBody();
17 assert_equals(table.firstChild, tbody);
18 assert_tbody(tbody);
19 }, "No child nodes");
20
21 test(function() {
22 var table = document.createElement("table");
23 var before = table.appendChild(document.createElement("tbody"));
24 assert_array_equals(table.childNodes, [before]);
25
26 var tbody = table.createTBody();
27 assert_array_equals(table.childNodes, [before, tbody]);
28 assert_tbody(tbody);
29 }, "One tbody child node");
30
31 test(function() {
32 var table = document.createElement("table");
33 var before1 = table.appendChild(document.createElement("tbody"));
34 var before2 = table.appendChild(document.createElement("tbody"));
35 assert_array_equals(table.childNodes, [before1, before2]);
36
37 var tbody = table.createTBody();
38 assert_array_equals(table.childNodes, [before1, before2, tbody]);
39 assert_tbody(tbody);
40 }, "Two tbody child nodes");
41
42 test(function() {
43 var table = document.createElement("table");
44 var before1 = table.appendChild(document.createElement("thead"));
45 var before2 = table.appendChild(document.createElement("tbody"));
46 assert_array_equals(table.childNodes, [before1, before2]);
47
48 var tbody = table.createTBody();
49 assert_array_equals(table.childNodes, [before1, before2, tbody]);
50 assert_tbody(tbody);
51 }, "A thead and a tbody child node");
52
53 test(function() {
54 var table = document.createElement("table");
55 var before1 = table.appendChild(document.createElement("tfoot"));
56 var before2 = table.appendChild(document.createElement("tbody"));
57 assert_array_equals(table.childNodes, [before1, before2]);
58
59 var tbody = table.createTBody();
60 assert_array_equals(table.childNodes, [before1, before2, tbody]);
61 assert_tbody(tbody);
62 }, "A tfoot and a tbody child node");
63
64 test(function() {
65 var table = document.createElement("table");
66 var before = table.appendChild(document.createElement("tbody"));
67 var after = table.appendChild(document.createElement("thead"));
68 assert_array_equals(table.childNodes, [before, after]);
69
70 var tbody = table.createTBody();
71 assert_array_equals(table.childNodes, [before, tbody, after]);
72 assert_tbody(tbody);
73 }, "A tbody and a thead child node");
74
75 test(function() {
76 var table = document.createElement("table");
77 var before = table.appendChild(document.createElement("tbody"));
78 var after = table.appendChild(document.createElement("tfoot"));
79 assert_array_equals(table.childNodes, [before, after]);
80
81 var tbody = table.createTBody();
82 assert_array_equals(table.childNodes, [before, tbody, after]);
83 assert_tbody(tbody);
84 }, "A tbody and a tfoot child node");
85
86 test(function() {
87 var table = document.createElement("table");
88 var before1 = table.appendChild(document.createElement("tbody"));
89 var before2 = table.appendChild(document.createElement("tbody"));
90 var after = table.appendChild(document.createElement("div"));
91 assert_array_equals(table.childNodes, [before1, before2, after]);
92
93 var tbody = table.createTBody();
94 assert_array_equals(table.childNodes, [before1, before2, tbody, after]);
95 assert_tbody(tbody);
96 }, "Two tbody child nodes and a div");
97
98 test(function() {
99 var table = document.createElement("table");
100 var before = table.appendChild(document.createElement("tbody"));
101 var after = table.appendChild(document.createElementNS("x", "tbody"));
102 assert_array_equals(table.childNodes, [before, after]);
103
104 var tbody = table.createTBody();
105 assert_array_equals(table.childNodes, [before, tbody, after]);
106 assert_tbody(tbody);
107 }, "One HTML and one namespaced tbody child node");
108
109 test(function() {
110 var table = document.createElement("table");
111 var before1 = table.appendChild(document.createElement("tbody"));
112 var before2 = before1.appendChild(document.createElement("tbody"));
113 assert_array_equals(table.childNodes, [before1]);
114
115 var tbody = table.createTBody();
116 assert_array_equals(table.childNodes, [before1, tbody]);
117 assert_tbody(tbody);
118 }, "Two nested tbody child nodes");
119
120 test(function() {
121 var table = document.createElement("table");
122 var before1 = table.appendChild(document.createElement("thead"));
123 var before2 = before1.appendChild(document.createElement("tbody"));
124 assert_array_equals(table.childNodes, [before1]);
125
126 var tbody = table.createTBody();
127 assert_array_equals(table.childNodes, [before1, tbody]);
128 assert_tbody(tbody);
129 }, "A tbody node inside a thead child node");
130
131 test(function() {
132 var table = document.createElement("table");
133 var before1 = table.appendChild(document.createElement("tfoot"));
134 var before2 = before1.appendChild(document.createElement("tbody"));
135 assert_array_equals(table.childNodes, [before1]);
136
137 var tbody = table.createTBody();
138 assert_array_equals(table.childNodes, [before1, tbody]);
139 assert_tbody(tbody);
140 }, "A tbody node inside a tfoot child node");
141
142 test(function() {
143 var table = document.createElement("table");
144 var before = table.appendChild(document.createElement("tbody"));
145 var after1 = table.appendChild(document.createElement("thead"));
146 var after2 = after1.appendChild(document.createElement("tbody"));
147 assert_array_equals(table.childNodes, [before, after1]);
148
149 var tbody = table.createTBody();
150 assert_array_equals(table.childNodes, [before, tbody, after1]);
151 assert_tbody(tbody);
152 }, "A tbody node inside a thead child node after a tbody child node");
153
154 test(function() {
155 var table = document.createElement("table");
156 var before = table.appendChild(document.createElement("tbody"));
157 var after1 = table.appendChild(document.createElement("tfoot"));
158 var after2 = after1.appendChild(document.createElement("tbody"));
159 assert_array_equals(table.childNodes, [before, after1]);
160
161 var tbody = table.createTBody();
162 assert_array_equals(table.childNodes, [before, tbody, after1]);
163 assert_tbody(tbody);
164 }, "A tbody node inside a tfoot child node after a tbody child node");
165 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698