accessible/tests/mochitest/table/test_headers_table.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 <!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
michael@0 2 <html>
michael@0 3 <head>
michael@0 4 <title>Table header information cells for HTML table</title>
michael@0 5 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
michael@0 6 <link rel="stylesheet" type="text/css"
michael@0 7 href="chrome://mochikit/content/tests/SimpleTest/test.css" />
michael@0 8
michael@0 9 <script type="application/javascript"
michael@0 10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
michael@0 11
michael@0 12 <script type="application/javascript"
michael@0 13 src="../common.js"></script>
michael@0 14 <script type="application/javascript"
michael@0 15 src="../table.js"></script>
michael@0 16
michael@0 17 <script type="application/javascript">
michael@0 18
michael@0 19 function doTest()
michael@0 20 {
michael@0 21 //////////////////////////////////////////////////////////////////////////
michael@0 22 // column header from thead and row header from @scope inside of tfoot
michael@0 23
michael@0 24 var headerInfoMap = [
michael@0 25 {
michael@0 26 cell: "table1_cell_1",
michael@0 27 rowHeaderCells: [],
michael@0 28 columnHeaderCells: [ "table1_weekday", "table1_date" ]
michael@0 29 },
michael@0 30 {
michael@0 31 cell: "table1_cell_2",
michael@0 32 rowHeaderCells: [],
michael@0 33 columnHeaderCells: [ "table1_day", "table1_date" ]
michael@0 34 },
michael@0 35 {
michael@0 36 cell: "table1_cell_3",
michael@0 37 rowHeaderCells: [],
michael@0 38 columnHeaderCells: [ "table1_qty" ]
michael@0 39 },
michael@0 40 {
michael@0 41 cell: "table1_cell_4",
michael@0 42 rowHeaderCells: [],
michael@0 43 columnHeaderCells: [ "table1_weekday", "table1_date" ]
michael@0 44 },
michael@0 45 {
michael@0 46 cell: "table1_cell_5",
michael@0 47 rowHeaderCells: [],
michael@0 48 columnHeaderCells: [ "table1_day", "table1_date" ]
michael@0 49 },
michael@0 50 {
michael@0 51 cell: "table1_cell_6",
michael@0 52 rowHeaderCells: [],
michael@0 53 columnHeaderCells: [ "table1_qty" ]
michael@0 54 },
michael@0 55 {
michael@0 56 cell: "table1_cell_7",
michael@0 57 rowHeaderCells: [ "table1_total" ],
michael@0 58 columnHeaderCells: [ "table1_qty" ]
michael@0 59 }
michael@0 60 ];
michael@0 61
michael@0 62 testHeaderCells(headerInfoMap);
michael@0 63
michael@0 64 //////////////////////////////////////////////////////////////////////////
michael@0 65 // column and row headers from thead and @scope
michael@0 66
michael@0 67 headerInfoMap = [
michael@0 68 {
michael@0 69 cell: "table2_cell_2",
michael@0 70 rowHeaderCells: [ "table2_rh_1" ],
michael@0 71 columnHeaderCells: [ "table2_ch_2" ]
michael@0 72 },
michael@0 73 {
michael@0 74 cell: "table2_cell_3",
michael@0 75 rowHeaderCells: [ "table2_rh_1" ],
michael@0 76 columnHeaderCells: [ "table2_ch_3" ]
michael@0 77 },
michael@0 78 {
michael@0 79 cell: "table2_cell_5",
michael@0 80 rowHeaderCells: [ "table2_rh_2" ],
michael@0 81 columnHeaderCells: [ "table2_ch_2" ]
michael@0 82 },
michael@0 83 {
michael@0 84 cell: "table2_cell_6",
michael@0 85 rowHeaderCells: [ "table2_rh_2" ],
michael@0 86 columnHeaderCells: [ "table2_ch_3" ]
michael@0 87 },
michael@0 88 {
michael@0 89 cell: "table2_rh_1",
michael@0 90 rowHeaderCells: [],
michael@0 91 columnHeaderCells: [ "table2_ch_1" ]
michael@0 92 },
michael@0 93 {
michael@0 94 cell: "table2_rh_2",
michael@0 95 rowHeaderCells: [],
michael@0 96 columnHeaderCells: [ "table2_ch_1" ]
michael@0 97 }
michael@0 98 ];
michael@0 99
michael@0 100 testHeaderCells(headerInfoMap);
michael@0 101
michael@0 102 //////////////////////////////////////////////////////////////////////////
michael@0 103 // column headers from @headers
michael@0 104
michael@0 105 headerInfoMap = [
michael@0 106 {
michael@0 107 cell: "table3_cell_1",
michael@0 108 rowHeaderCells: [],
michael@0 109 columnHeaderCells: [ "table3_ch_1" ]
michael@0 110 },
michael@0 111 {
michael@0 112 cell: "table3_cell_2",
michael@0 113 rowHeaderCells: [],
michael@0 114 columnHeaderCells: [ "table3_ch_2" ]
michael@0 115 }
michael@0 116 ];
michael@0 117
michael@0 118 testHeaderCells(headerInfoMap);
michael@0 119
michael@0 120 //////////////////////////////////////////////////////////////////////////
michael@0 121 // table consisted of one column
michael@0 122
michael@0 123 headerInfoMap = [
michael@0 124 {
michael@0 125 cell: "table4_cell",
michael@0 126 rowHeaderCells: [],
michael@0 127 columnHeaderCells: [ "table4_ch" ]
michael@0 128 }
michael@0 129 ];
michael@0 130
michael@0 131 testHeaderCells(headerInfoMap);
michael@0 132
michael@0 133 //////////////////////////////////////////////////////////////////////////
michael@0 134 // table consisted of one row
michael@0 135
michael@0 136 headerInfoMap = [
michael@0 137 {
michael@0 138 cell: "table5_cell",
michael@0 139 rowHeaderCells: [ "table5_rh" ],
michael@0 140 columnHeaderCells: [ ]
michael@0 141 }
michael@0 142 ];
michael@0 143
michael@0 144 testHeaderCells(headerInfoMap);
michael@0 145
michael@0 146 //////////////////////////////////////////////////////////////////////////
michael@0 147 // @headers points to table cells
michael@0 148
michael@0 149 headerInfoMap = [
michael@0 150 {
michael@0 151 cell: "table6_cell",
michael@0 152 rowHeaderCells: [ "table6_rh" ],
michael@0 153 columnHeaderCells: [ "table6_ch" ]
michael@0 154 }
michael@0 155 ];
michael@0 156
michael@0 157 testHeaderCells(headerInfoMap);
michael@0 158
michael@0 159 SimpleTest.finish();
michael@0 160 }
michael@0 161
michael@0 162 SimpleTest.waitForExplicitFinish();
michael@0 163 addA11yLoadEvent(doTest);
michael@0 164 </script>
michael@0 165 </head>
michael@0 166
michael@0 167 <body>
michael@0 168 <a target="_blank"
michael@0 169 title="implement IAccessibleTable2"
michael@0 170 href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">
michael@0 171 Bug 512424
michael@0 172 </a>
michael@0 173 <a target="_blank"
michael@0 174 title="Table headers not associated when header is a td element with no scope"
michael@0 175 href="https://bugzilla.mozilla.org/show_bug.cgi?id=704465">
michael@0 176 Bug 704465
michael@0 177 </a>
michael@0 178
michael@0 179 <p id="display"></p>
michael@0 180 <div id="content" style="display: none"></div>
michael@0 181 <pre id="test">
michael@0 182 </pre>
michael@0 183
michael@0 184 <table id="table1" border="1">
michael@0 185 <thead>
michael@0 186 <tr>
michael@0 187 <th id="table1_date" colspan="2">Date</th>
michael@0 188 <th id="table1_qty" rowspan="2">Qty</th>
michael@0 189 </tr>
michael@0 190 <tr>
michael@0 191 <th id="table1_weekday">Weekday</th>
michael@0 192 <th id="table1_day">Day</th>
michael@0 193 </tr>
michael@0 194 </thead>
michael@0 195 <tbody>
michael@0 196 <tr>
michael@0 197 <td id="table1_cell_1">Mon</td>
michael@0 198 <td id="table1_cell_2">1</td>
michael@0 199 <td id="table1_cell_3">20</td>
michael@0 200 </tr>
michael@0 201 <tr>
michael@0 202 <td id="table1_cell_4">Thu</td>
michael@0 203 <td id="table1_cell_5">2</td>
michael@0 204 <td id="table1_cell_6">15</td>
michael@0 205 </tr>
michael@0 206 </tbody>
michael@0 207 <tfoot>
michael@0 208 <tr>
michael@0 209 <th id="table1_total" scope="row" colspan="2">Total</th>
michael@0 210 <td id="table1_cell_7">35</td>
michael@0 211 </tr>
michael@0 212 </tfoot>
michael@0 213 </table>
michael@0 214
michael@0 215 <table id="table2" border="1">
michael@0 216 <thead>
michael@0 217 <tr>
michael@0 218 <th id="table2_ch_1">col1</th>
michael@0 219 <th id="table2_ch_2">col2</th>
michael@0 220 <td id="table2_ch_3" scope="col">col3</td>
michael@0 221 </tr>
michael@0 222 </thead>
michael@0 223 <tbody>
michael@0 224 <tr>
michael@0 225 <th id="table2_rh_1">row1</th>
michael@0 226 <td id="table2_cell_2">cell1</td>
michael@0 227 <td id="table2_cell_3">cell2</td>
michael@0 228 </tr>
michael@0 229 <tr>
michael@0 230 <td id="table2_rh_2" scope="row">row2</td>
michael@0 231 <td id="table2_cell_5">cell3</td>
michael@0 232 <td id="table2_cell_6">cell4</td>
michael@0 233 </tr>
michael@0 234 </tbody>
michael@0 235 </table>
michael@0 236
michael@0 237 <table id="table3" border="1">
michael@0 238 <tr>
michael@0 239 <td id="table3_cell_1" headers="table3_ch_1">cell1</td>
michael@0 240 <td id="table3_cell_2" headers="table3_ch_2">cell2</td>
michael@0 241 </tr>
michael@0 242 <tr>
michael@0 243 <td id="table3_ch_1" scope="col">col1</td>
michael@0 244 <td id="table3_ch_2" scope="col">col2</td>
michael@0 245 </tr>
michael@0 246 </table>
michael@0 247
michael@0 248 <table id="table4">
michael@0 249 <thead>
michael@0 250 <tr>
michael@0 251 <th id="table4_ch">colheader</th>
michael@0 252 </tr>
michael@0 253 </thead>
michael@0 254 <tbody>
michael@0 255 <tr>
michael@0 256 <td id="table4_cell">bla</td>
michael@0 257 </tr>
michael@0 258 </tbody>
michael@0 259 </table>
michael@0 260
michael@0 261 <table id="table5">
michael@0 262 <tr>
michael@0 263 <th id="table5_rh">rowheader</th>
michael@0 264 <td id="table5_cell">cell</td>
michael@0 265 </tr>
michael@0 266 </table>
michael@0 267
michael@0 268 <table id="table6">
michael@0 269 <tr>
michael@0 270 <td>empty cell</th>
michael@0 271 <td id="table6_ch">colheader</td>
michael@0 272 </tr>
michael@0 273 <tr>
michael@0 274 <td id="table6_rh">rowheader</th>
michael@0 275 <td id="table6_cell" headers="table6_ch table6_rh">cell</td>
michael@0 276 </tr>
michael@0 277 </table>
michael@0 278 </body>
michael@0 279 </html>

mercurial