summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/windows/ia2/browser_role.js
blob: 08e44c280f5c176d77315f2f33d190d47ba2f783 (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
/* 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";

const ROLE_SYSTEM_DOCUMENT = 15;
const ROLE_SYSTEM_GROUPING = 20;
const IA2_ROLE_PARAGRAPH = 1054;

addAccessibleTask(
  `
<p id="p">p</p>
  `,
  async function (browser, docAcc) {
    let role = await runPython(`
      global doc
      doc = getDocIa2()
      return doc.accRole(CHILDID_SELF)
    `);
    is(role, ROLE_SYSTEM_DOCUMENT, "doc has correct MSAA role");
    role = await runPython(`doc.role()`);
    is(role, ROLE_SYSTEM_DOCUMENT, "doc has correct IA2 role");
    ok(
      await runPython(`
        global p
        p = findIa2ByDomId(doc, "p")
        firstChild = toIa2(doc.accChild(1))
        return p == firstChild
      `),
      "doc's first child is p"
    );
    role = await runPython(`p.accRole(CHILDID_SELF)`);
    is(role, ROLE_SYSTEM_GROUPING, "p has correct MSAA role");
    role = await runPython(`p.role()`);
    is(role, IA2_ROLE_PARAGRAPH, "p has correct IA2 role");
  },
  { chrome: true, topLevel: true, iframe: true, remoteIframe: true }
);