summaryrefslogtreecommitdiffstats
path: root/accessible/tests/mochitest/table/test_headers_ariagrid.html
blob: 7b2c3f3dbfd2fc032c844677c3411b41c452223c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
  <title>Table header information cells for ARIA grid</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" type="text/css"
        href="chrome://mochikit/content/tests/SimpleTest/test.css" />

  <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>

  <script type="application/javascript"
          src="../common.js"></script>
  <script type="application/javascript"
          src="../table.js"></script>

  <script type="application/javascript">

    function doTest() {
      // ////////////////////////////////////////////////////////////////////////
      // column and row headers from markup

      let headerInfoMap = [
        {
          cell: "table_dc_1",
          rowHeaderCells: [ "table_rh_1" ],
          columnHeaderCells: [ "table_ch_2" ],
        },
        {
          cell: "table_dc_2",
          rowHeaderCells: [ "table_rh_1" ],
          columnHeaderCells: [ "table_ch_3" ],
        },
        {
          cell: "table_dc_3",
          rowHeaderCells: [ "table_rh_2" ],
          columnHeaderCells: [ "table_ch_2" ],
        },
        {
          cell: "table_dc_4",
          rowHeaderCells: [ "table_rh_2" ],
          columnHeaderCells: [ "table_ch_3" ],
        },
        {
          cell: "table_rh_1",
          rowHeaderCells: [],
          columnHeaderCells: [ "table_ch_1" ],
        },
        {
          cell: "table_rh_2",
          rowHeaderCells: [],
          columnHeaderCells: [ "table_ch_1" ],
        },
      ];

      testHeaderCells(headerInfoMap);


      // ////////////////////////////////////////////////////////////////////////
      // column and row headers from markup for grid.

      headerInfoMap = [
        {
          // not focusable cell (ARIAGridCellAccessible is used)
          cell: "table2_dc_1",
          rowHeaderCells: [],
          columnHeaderCells: [ "table2_ch_1" ],
        },
        {
          // focusable cell (ARIAGridCellAccessible is used)
          cell: "table2_dc_2",
          rowHeaderCells: [],
          columnHeaderCells: [ "table2_ch_2" ],
        },
      ];

      testHeaderCells(headerInfoMap);


      // ////////////////////////////////////////////////////////////////////////
      // column and row headers from markup for one more grid.

      headerInfoMap = [
        {
          // ARIAGridCellAccessible is used
          cell: "t3_dc_1",
          rowHeaderCells: [ "t3_rh_1" ],
          columnHeaderCells: [ ],
        },
        {
          // ARIAGridCellAccessible is used (inside rowgroup)
          cell: "t3_dc_2",
          rowHeaderCells: [ "t3_rh_2" ],
          columnHeaderCells: [ ],
        },
      ];

      testHeaderCells(headerInfoMap);

      SimpleTest.finish();
    }

    SimpleTest.waitForExplicitFinish();
    addA11yLoadEvent(doTest);
  </script>
</head>

<body>
  <a target="_blank"
     title="implement IAccessibleTable2"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
  <a target="_blank"
     title="nsHTMLTableCellAccessible is used in dojo's ARIA grid"
     href="https://bugzilla.mozilla.org/show_bug.cgi?id=513848">Mozilla Bug 513848</a>

  <p id="display"></p>
  <div id="content" style="display: none"></div>
  <pre id="test">
  </pre>

  <div role="grid">
    <div role="row">
      <span id="table_ch_1" role="columnheader">col_1</span>
      <span id="table_ch_2" role="columnheader">col_2</span>
      <span id="table_ch_3" role="columnheader">col_3</span>
    </div>
    <div role="row">
      <span id="table_rh_1" role="rowheader">row_1</span>
      <span id="table_dc_1" role="gridcell">cell1</span>
      <span id="table_dc_2" role="gridcell">cell2</span>
    </div>
    <div role="row">
      <span id="table_rh_2" role="rowheader">row_2</span>
      <span id="table_dc_3" role="gridcell">cell3</span>
      <span id="table_dc_4" role="gridcell">cell4</span>
    </div>
  </div>

  <div role="grid">
    <div role="row">
      <table role="presentation">
        <tr>
          <td id="table2_ch_1" role="columnheader">header1</td>
          <td id="table2_ch_2" role="columnheader">header2</td>
        </tr>
      </table>
    </div>
    <div role="row">
      <table role="presentation">
        <tr>
          <td id="table2_dc_1" role="gridcell">cell1</td>
          <td id="table2_dc_2" role="gridcell" tabindex="-1">cell2</td>
        </tr>
      </table>
    </div>
  </div>

  <div role="grid">
    <table role="presentation">
      <tbody role="presentation">
        <tr role="row">
          <th id="t3_rh_1" role="rowheader">Row 1</th>
          <td id="t3_dc_1" role="gridcell" tabindex="-1">
            Apple Inc.
          </td>
        </tr>
      </tbody>
    </table>
    <div role="rowgroup" tabindex="0">
      <table role="presentation">
        <tbody role="presentation">
          <tr role="row">
            <th id="t3_rh_2" role="rowheader">Row 2</th>
            <td id="t3_dc_2" role="gridcell" tabindex="-1">
              Apple-Shmapple Inc.
            </td>
          </tr>
        </tbody>
      </table>
    </div>
  </div>

</body>
</html>