tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

browser_aria_busy.js (1358B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /* import-globals-from ../../mochitest/role.js */
      8 /* import-globals-from ../../mochitest/states.js */
      9 loadScripts(
     10  { name: "role.js", dir: MOCHITESTS_DIR },
     11  { name: "states.js", dir: MOCHITESTS_DIR }
     12 );
     13 
     14 /**
     15 * Test aria-busy
     16 */
     17 addAccessibleTask(
     18  `<div id="section" role="group">Hello</div>`,
     19  async (browser, accDoc) => {
     20    let section = getNativeInterface(accDoc, "section");
     21 
     22    ok(!section.getAttributeValue("AXElementBusy"), "section is not busy");
     23 
     24    let busyChanged = waitForMacEvent("AXElementBusyChanged", "section");
     25    await SpecialPowers.spawn(browser, [], () => {
     26      content.document
     27        .getElementById("section")
     28        .setAttribute("aria-busy", "true");
     29    });
     30    await busyChanged;
     31 
     32    ok(section.getAttributeValue("AXElementBusy"), "section is busy");
     33 
     34    busyChanged = waitForMacEvent("AXElementBusyChanged", "section");
     35    await SpecialPowers.spawn(browser, [], () => {
     36      content.document
     37        .getElementById("section")
     38        .setAttribute("aria-busy", "false");
     39    });
     40    await busyChanged;
     41 
     42    ok(!section.getAttributeValue("AXElementBusy"), "section is not busy");
     43  }
     44 );