summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/atk/browser_table.js
blob: 98b3270465f5f1dc4dca9c3dcf5047a5b420ccbc (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
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

"use strict";

/**
 * Test getRowColumnSpan.
 */
addAccessibleTask(
  `
<table>
  <tr>
    <th id="ab" colspan="2">ab</th>
    <td id="cf" rowspan="2">cf</td>
  </tr>
  <tr>
    <td id="d">d</td>
    <td>e</td>
  </tr>
</table>
  `,
  async function (browser, docAcc) {
    let result = await runPython(`
      global doc
      doc = getDoc()
      ab = findByDomId(doc, "ab")
      return str(ab.queryTableCell().getRowColumnSpan())
    `);
    is(
      result,
      "(row=0, column=0, row_span=1, column_span=2)",
      "ab getColumnRowSpan correct"
    );
    result = await runPython(`
      cf = findByDomId(doc, "cf")
      return str(cf.queryTableCell().getRowColumnSpan())
    `);
    is(
      result,
      "(row=0, column=2, row_span=2, column_span=1)",
      "cf getColumnRowSpan correct"
    );
    result = await runPython(`
      d = findByDomId(doc, "d")
      return str(d.queryTableCell().getRowColumnSpan())
    `);
    is(
      result,
      "(row=1, column=0, row_span=1, column_span=1)",
      "d getColumnRowSpan correct"
    );
  }
);