tor-browser

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

browser_treeupdate_list.js (1387B)


      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 loadScripts({ name: "role.js", dir: MOCHITESTS_DIR });
      9 
     10 async function setDisplayAndWaitForReorder(browser, value) {
     11  let onReorder = waitForEvent(EVENT_REORDER, "ul");
     12  await invokeSetStyle(browser, "li", "display", value);
     13  return onReorder;
     14 }
     15 
     16 addAccessibleTask(
     17  `
     18  <ul id="ul">
     19    <li id="li">item1</li>
     20  </ul>`,
     21  async function (browser, accDoc) {
     22    let li = findAccessibleChildByID(accDoc, "li");
     23    let bullet = li.firstChild;
     24    let accTree = {
     25      role: ROLE_LISTITEM,
     26      children: [
     27        {
     28          role: ROLE_LISTITEM_MARKER,
     29          children: [],
     30        },
     31        {
     32          role: ROLE_TEXT_LEAF,
     33          children: [],
     34        },
     35      ],
     36    };
     37    testAccessibleTree(li, accTree);
     38 
     39    await setDisplayAndWaitForReorder(browser, "none");
     40 
     41    ok(isDefunct(li), "Check that li is defunct.");
     42    ok(isDefunct(bullet), "Check that bullet is defunct.");
     43 
     44    let event = await setDisplayAndWaitForReorder(browser, "list-item");
     45 
     46    testAccessibleTree(
     47      findAccessibleChildByID(event.accessible, "li"),
     48      accTree
     49    );
     50  },
     51  { iframe: true, remoteIframe: true }
     52 );