tor-browser

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

browser_aria_setsize.js (1392B)


      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 /**
      8 * Test aria-setsize and aria-posinset
      9 */
     10 addAccessibleTask(
     11  `<div role="listbox" id="select" aria-label="Choose a number">
     12     <div role="option" id="two" aria-setsize="5" aria-posinset="2">Two</div>
     13     <div role="option" id="three" aria-setsize="5" aria-posinset="3">Three</div>
     14     <div role="option" id="four" aria-setsize="5" aria-posinset="4">Four</div>
     15   </div>
     16   <p id="p">Hello</p>`,
     17  async (browser, accDoc) => {
     18    function testPosInSet(id, setsize, posinset) {
     19      let elem = getNativeInterface(accDoc, id);
     20      is(
     21        elem.getAttributeValue("AXARIASetSize"),
     22        setsize,
     23        `${id}: Correct set size`
     24      );
     25 
     26      is(
     27        elem.getAttributeValue("AXARIAPosInSet"),
     28        posinset,
     29        `${id}: Correct position in set`
     30      );
     31    }
     32 
     33    testPosInSet("two", 5, 2);
     34    testPosInSet("three", 5, 3);
     35    testPosInSet("four", 5, 4);
     36 
     37    let p = getNativeInterface(accDoc, "p");
     38    ok(
     39      !p.attributeNames.includes("AXARIASetSize"),
     40      "Paragraph should not have AXARIASetSize"
     41    );
     42    ok(
     43      !p.attributeNames.includes("AXARIAPosInSet"),
     44      "Paragraph should not have AXARIAPosInSet"
     45    );
     46  }
     47 );