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

Side by Side Diff: LayoutTests/imported/web-platform-tests/html/semantics/tabular-data/the-tr-element/sectionRowIndex.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>HTMLTableRowElement.sectionRowIndex</title>
4 <script src="../../../../../../resources/testharness.js"></script>
5 <script src="../../../../../../resources/testharnessreport.js"></script>
6 <div id="log"></div>
7 <table>
8 <thead>
9 <tr id="ht1"></tr>
10 </thead>
11 <tr id="t1"></tr>
12 <tr id="t2">
13 <td>
14 <table>
15 <thead>
16 <tr id="nht1"></tr>
17 </thead>
18 <tr></tr>
19 <tr id="nt1"></tr>
20 <tbody>
21 <tr id="nbt1"></tr>
22 </tbody>
23 </table>
24 </td>
25 </tr>
26 <tbody>
27 <tr></tr>
28 <tr id="bt1"></tr>
29 </tbody>
30 <tfoot>
31 <tr></tr>
32 <tr></tr>
33 <tr id="ft1"></tr>
34 </tfoot>
35 </table>
36
37 <script>
38 test(function() {
39 var tHeadRow = document.getElementById('ht1');
40 assert_equals(tHeadRow.sectionRowIndex, 0);
41 }, "Row in thead in HTML");
42
43 test(function() {
44 var tRow1 = document.getElementById('t1');
45 assert_equals(tRow1.sectionRowIndex, 0);
46 }, "Row in implicit tbody in HTML");
47
48 test(function() {
49 var tRow2 = document.getElementById('t2');
50 assert_equals(tRow2.sectionRowIndex, 1);
51 }, "Other row in implicit tbody in HTML");
52
53 test(function() {
54 var tBodyRow = document.getElementById('bt1');
55 assert_equals(tBodyRow.sectionRowIndex, 1);
56 }, "Row in explicit tbody in HTML");
57
58 test(function() {
59 var tFootRow = document.getElementById('ft1');
60 assert_equals(tFootRow.sectionRowIndex, 2);
61 }, "Row in tfoot in HTML");
62
63 test(function() {
64 var childHeadRow = document.getElementById('nht1');
65 assert_equals(childHeadRow.sectionRowIndex, 0);
66 }, "Row in thead in nested table in HTML");
67
68 test(function() {
69 var childRow = document.getElementById('nt1');
70 assert_equals(childRow.sectionRowIndex, 1);
71 }, "Row in implicit tbody in nested table in HTML");
72
73 test(function() {
74 var childBodyRow = document.getElementById('nbt1');
75 assert_equals(childBodyRow.sectionRowIndex, 0);
76 }, "Row in explicit tbody in nested table in HTML");
77
78 /* script create element test */
79 var mkTrElm = function (elst) {
80 var elm = document.createElement("table");
81 elst.forEach(function(item) {
82 elm = elm.appendChild(document.createElement(item));
83 });
84 return elm.appendChild(document.createElement("tr"));
85 };
86
87 test(function() {
88 assert_equals(mkTrElm([]).sectionRowIndex, 0);
89 }, "Row in script-created table");
90
91 test(function() {
92 assert_equals(mkTrElm(["div"]).sectionRowIndex, -1);
93 }, "Row in script-created div in table");
94
95 test(function() {
96 assert_equals(mkTrElm(["thead"]).sectionRowIndex, 0);
97 }, "Row in script-created thead in table");
98
99 test(function() {
100 assert_equals(mkTrElm(["tbody"]).sectionRowIndex, 0);
101 }, "Row in script-created tbody in table");
102
103 test(function() {
104 assert_equals(mkTrElm(["tfoot"]).sectionRowIndex, 0);
105 }, "Row in script-created tfoot in table");
106
107 test(function() {
108 assert_equals(mkTrElm(["tbody", "tr"]).sectionRowIndex, -1);
109 }, "Row in script-created tr in tbody in table");
110
111 test(function() {
112 assert_equals(mkTrElm(["tbody", "tr", "td"]).sectionRowIndex, -1);
113 }, "Row in script-created td in tr in tbody in table");
114
115 test(function() {
116 assert_equals(mkTrElm(["tbody", "tr", "td", "table"]).sectionRowIndex, 0);
117 }, "Row in script-created nested table");
118
119 test(function() {
120 assert_equals(mkTrElm(["tbody", "tr", "td", "table", "thead"]).sectionRowIndex , 0);
121 }, "Row in script-created thead in nested table");
122
123 test(function() {
124 assert_equals(mkTrElm(["tbody", "tr", "td", "table", "tbody"]).sectionRowIndex , 0);
125 }, "Row in script-created tbody in nested table");
126
127 test(function() {
128 assert_equals(mkTrElm(["tbody", "tr", "td", "table", "tfoot"]).sectionRowIndex , 0);
129 }, "Row in script-created tfoot in nested table");
130 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698