summaryrefslogtreecommitdiffstats
path: root/accessible/tests/browser/mac/browser_aria_busy.js
blob: e75d334e295bcaa04da50b86dbaf37d5cc0ae108 (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
/* 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";

/* import-globals-from ../../mochitest/role.js */
/* import-globals-from ../../mochitest/states.js */
loadScripts(
  { name: "role.js", dir: MOCHITESTS_DIR },
  { name: "states.js", dir: MOCHITESTS_DIR }
);

/**
 * Test aria-busy
 */
addAccessibleTask(
  `<div id="section" role="group">Hello</div>`,
  async (browser, accDoc) => {
    let section = getNativeInterface(accDoc, "section");

    ok(!section.getAttributeValue("AXElementBusy"), "section is not busy");

    let busyChanged = waitForMacEvent("AXElementBusyChanged", "section");
    await SpecialPowers.spawn(browser, [], () => {
      content.document
        .getElementById("section")
        .setAttribute("aria-busy", "true");
    });
    await busyChanged;

    ok(section.getAttributeValue("AXElementBusy"), "section is busy");

    busyChanged = waitForMacEvent("AXElementBusyChanged", "section");
    await SpecialPowers.spawn(browser, [], () => {
      content.document
        .getElementById("section")
        .setAttribute("aria-busy", "false");
    });
    await busyChanged;

    ok(!section.getAttributeValue("AXElementBusy"), "section is not busy");
  }
);