accessible/tests/mochitest/table/test_headers_table.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/accessible/tests/mochitest/table/test_headers_table.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,279 @@
     1.4 +<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
     1.5 +<html>
     1.6 +<head>
     1.7 +  <title>Table header information cells for HTML table</title>
     1.8 +  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     1.9 +  <link rel="stylesheet" type="text/css"
    1.10 +        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
    1.11 +
    1.12 +  <script type="application/javascript"
    1.13 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    1.14 +
    1.15 +  <script type="application/javascript"
    1.16 +          src="../common.js"></script>
    1.17 +  <script type="application/javascript"
    1.18 +          src="../table.js"></script>
    1.19 +
    1.20 +  <script type="application/javascript">
    1.21 +
    1.22 +    function doTest()
    1.23 +    {
    1.24 +      //////////////////////////////////////////////////////////////////////////
    1.25 +      // column header from thead and row header from @scope inside of tfoot
    1.26 +
    1.27 +      var headerInfoMap = [
    1.28 +        {
    1.29 +          cell: "table1_cell_1",
    1.30 +          rowHeaderCells: [],
    1.31 +          columnHeaderCells: [ "table1_weekday", "table1_date" ]
    1.32 +        },
    1.33 +        {
    1.34 +          cell: "table1_cell_2",
    1.35 +          rowHeaderCells: [],
    1.36 +          columnHeaderCells: [ "table1_day", "table1_date" ]
    1.37 +        },
    1.38 +        {
    1.39 +          cell: "table1_cell_3",
    1.40 +          rowHeaderCells: [],
    1.41 +          columnHeaderCells: [ "table1_qty" ]
    1.42 +        },
    1.43 +        {
    1.44 +          cell: "table1_cell_4",
    1.45 +          rowHeaderCells: [],
    1.46 +          columnHeaderCells: [ "table1_weekday", "table1_date" ]
    1.47 +        },
    1.48 +        {
    1.49 +          cell: "table1_cell_5",
    1.50 +          rowHeaderCells: [],
    1.51 +          columnHeaderCells: [ "table1_day", "table1_date" ]
    1.52 +        },
    1.53 +        {
    1.54 +          cell: "table1_cell_6",
    1.55 +          rowHeaderCells: [],
    1.56 +          columnHeaderCells: [ "table1_qty" ]
    1.57 +        },
    1.58 +        {
    1.59 +          cell: "table1_cell_7",
    1.60 +          rowHeaderCells: [ "table1_total" ],
    1.61 +          columnHeaderCells: [ "table1_qty" ]
    1.62 +        }
    1.63 +      ];
    1.64 +
    1.65 +      testHeaderCells(headerInfoMap);
    1.66 +
    1.67 +      //////////////////////////////////////////////////////////////////////////
    1.68 +      // column and row headers from thead and @scope
    1.69 +
    1.70 +      headerInfoMap = [
    1.71 +        {
    1.72 +          cell: "table2_cell_2",
    1.73 +          rowHeaderCells: [ "table2_rh_1" ],
    1.74 +          columnHeaderCells: [ "table2_ch_2" ]
    1.75 +        },
    1.76 +        {
    1.77 +          cell: "table2_cell_3",
    1.78 +          rowHeaderCells: [ "table2_rh_1" ],
    1.79 +          columnHeaderCells: [ "table2_ch_3" ]
    1.80 +        },
    1.81 +        {
    1.82 +          cell: "table2_cell_5",
    1.83 +          rowHeaderCells: [ "table2_rh_2" ],
    1.84 +          columnHeaderCells: [ "table2_ch_2" ]
    1.85 +        },
    1.86 +        {
    1.87 +          cell: "table2_cell_6",
    1.88 +          rowHeaderCells: [ "table2_rh_2" ],
    1.89 +          columnHeaderCells: [ "table2_ch_3" ]
    1.90 +        },
    1.91 +        {
    1.92 +          cell: "table2_rh_1",
    1.93 +          rowHeaderCells: [],
    1.94 +          columnHeaderCells: [ "table2_ch_1" ]
    1.95 +        },
    1.96 +        {
    1.97 +          cell: "table2_rh_2",
    1.98 +          rowHeaderCells: [],
    1.99 +          columnHeaderCells: [ "table2_ch_1" ]
   1.100 +        }
   1.101 +      ];
   1.102 +
   1.103 +      testHeaderCells(headerInfoMap);
   1.104 +
   1.105 +      //////////////////////////////////////////////////////////////////////////
   1.106 +      // column headers from @headers
   1.107 +
   1.108 +      headerInfoMap = [
   1.109 +        {
   1.110 +          cell: "table3_cell_1",
   1.111 +          rowHeaderCells: [],
   1.112 +          columnHeaderCells: [ "table3_ch_1" ]
   1.113 +        },
   1.114 +        {
   1.115 +          cell: "table3_cell_2",
   1.116 +          rowHeaderCells: [],
   1.117 +          columnHeaderCells: [ "table3_ch_2" ]
   1.118 +        }
   1.119 +      ];
   1.120 +
   1.121 +      testHeaderCells(headerInfoMap);
   1.122 +
   1.123 +      //////////////////////////////////////////////////////////////////////////
   1.124 +      // table consisted of one column
   1.125 +
   1.126 +      headerInfoMap = [
   1.127 +        {
   1.128 +          cell: "table4_cell",
   1.129 +          rowHeaderCells: [],
   1.130 +          columnHeaderCells: [ "table4_ch" ]
   1.131 +        }
   1.132 +      ];
   1.133 +
   1.134 +      testHeaderCells(headerInfoMap);
   1.135 +
   1.136 +      //////////////////////////////////////////////////////////////////////////
   1.137 +      // table consisted of one row
   1.138 +
   1.139 +      headerInfoMap = [
   1.140 +        {
   1.141 +          cell: "table5_cell",
   1.142 +          rowHeaderCells: [ "table5_rh" ],
   1.143 +          columnHeaderCells: [ ]
   1.144 +        }
   1.145 +      ];
   1.146 +
   1.147 +      testHeaderCells(headerInfoMap);
   1.148 +
   1.149 +      //////////////////////////////////////////////////////////////////////////
   1.150 +      // @headers points to table cells
   1.151 +
   1.152 +      headerInfoMap = [
   1.153 +        {
   1.154 +          cell: "table6_cell",
   1.155 +          rowHeaderCells: [ "table6_rh" ],
   1.156 +          columnHeaderCells: [ "table6_ch" ]
   1.157 +        }
   1.158 +      ];
   1.159 +
   1.160 +      testHeaderCells(headerInfoMap);
   1.161 +
   1.162 +      SimpleTest.finish();
   1.163 +    }
   1.164 +
   1.165 +    SimpleTest.waitForExplicitFinish();
   1.166 +    addA11yLoadEvent(doTest);
   1.167 +  </script>
   1.168 +</head>
   1.169 +
   1.170 +<body>
   1.171 +  <a target="_blank"
   1.172 +     title="implement IAccessibleTable2"
   1.173 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">
   1.174 +    Bug 512424
   1.175 +  </a>
   1.176 +  <a target="_blank"
   1.177 +     title="Table headers not associated when header is a td element with no scope"
   1.178 +     href="https://bugzilla.mozilla.org/show_bug.cgi?id=704465">
   1.179 +    Bug 704465
   1.180 +  </a>
   1.181 +
   1.182 +  <p id="display"></p>
   1.183 +  <div id="content" style="display: none"></div>
   1.184 +  <pre id="test">
   1.185 +  </pre>
   1.186 +
   1.187 +  <table id="table1" border="1">
   1.188 +    <thead>
   1.189 +      <tr>
   1.190 +        <th id="table1_date" colspan="2">Date</th>
   1.191 +        <th id="table1_qty" rowspan="2">Qty</th>
   1.192 +      </tr>
   1.193 +      <tr>
   1.194 +        <th id="table1_weekday">Weekday</th>
   1.195 +        <th id="table1_day">Day</th>
   1.196 +      </tr>
   1.197 +    </thead>
   1.198 +    <tbody>
   1.199 +      <tr>
   1.200 +        <td id="table1_cell_1">Mon</td>
   1.201 +        <td id="table1_cell_2">1</td>
   1.202 +        <td id="table1_cell_3">20</td>
   1.203 +      </tr>
   1.204 +      <tr>
   1.205 +        <td id="table1_cell_4">Thu</td>
   1.206 +        <td id="table1_cell_5">2</td>
   1.207 +        <td id="table1_cell_6">15</td>
   1.208 +      </tr>
   1.209 +    </tbody>
   1.210 +    <tfoot>
   1.211 +      <tr>
   1.212 +        <th id="table1_total" scope="row" colspan="2">Total</th>
   1.213 +        <td id="table1_cell_7">35</td>
   1.214 +      </tr>
   1.215 +    </tfoot>
   1.216 +  </table>
   1.217 +
   1.218 +  <table id="table2" border="1">
   1.219 +    <thead>
   1.220 +      <tr>
   1.221 +        <th id="table2_ch_1">col1</th>
   1.222 +        <th id="table2_ch_2">col2</th>
   1.223 +        <td id="table2_ch_3" scope="col">col3</td>
   1.224 +      </tr>
   1.225 +    </thead>
   1.226 +    <tbody>
   1.227 +      <tr>
   1.228 +        <th id="table2_rh_1">row1</th>
   1.229 +        <td id="table2_cell_2">cell1</td>
   1.230 +        <td id="table2_cell_3">cell2</td>
   1.231 +      </tr>
   1.232 +      <tr>
   1.233 +        <td id="table2_rh_2" scope="row">row2</td>
   1.234 +        <td id="table2_cell_5">cell3</td>
   1.235 +        <td id="table2_cell_6">cell4</td>
   1.236 +      </tr>
   1.237 +    </tbody>
   1.238 +  </table>
   1.239 +
   1.240 +  <table id="table3" border="1">
   1.241 +    <tr>
   1.242 +      <td id="table3_cell_1" headers="table3_ch_1">cell1</td>
   1.243 +      <td id="table3_cell_2" headers="table3_ch_2">cell2</td>
   1.244 +    </tr>
   1.245 +    <tr>
   1.246 +      <td id="table3_ch_1" scope="col">col1</td>
   1.247 +      <td id="table3_ch_2" scope="col">col2</td>
   1.248 +    </tr>
   1.249 +  </table>
   1.250 +
   1.251 +  <table id="table4">
   1.252 +    <thead>
   1.253 +      <tr>
   1.254 +        <th id="table4_ch">colheader</th>
   1.255 +      </tr>
   1.256 +    </thead>
   1.257 +    <tbody>
   1.258 +      <tr>
   1.259 +        <td id="table4_cell">bla</td>
   1.260 +      </tr>
   1.261 +    </tbody>
   1.262 +  </table>
   1.263 +
   1.264 +  <table id="table5">
   1.265 +    <tr>
   1.266 +      <th id="table5_rh">rowheader</th>
   1.267 +      <td id="table5_cell">cell</td>
   1.268 +    </tr>
   1.269 +  </table>
   1.270 +
   1.271 +  <table id="table6">
   1.272 +    <tr>
   1.273 +      <td>empty cell</th>
   1.274 +      <td id="table6_ch">colheader</td>
   1.275 +    </tr>
   1.276 +    <tr>
   1.277 +      <td id="table6_rh">rowheader</th>
   1.278 +      <td id="table6_cell" headers="table6_ch table6_rh">cell</td>
   1.279 +    </tr>
   1.280 +  </table>
   1.281 +</body>
   1.282 +</html>

mercurial