tor-browser

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

browser_treeupdate_textleaf.js (1190B)


      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 removeTextData(browser, accessible, id, role) {
     11  let tree = {
     12    role,
     13    children: [{ role: ROLE_TEXT_LEAF, name: "text" }],
     14  };
     15  testAccessibleTree(accessible, tree);
     16 
     17  let onReorder = waitForEvent(EVENT_REORDER, id);
     18  await invokeContentTask(browser, [id], contentId => {
     19    content.document.getElementById(contentId).firstChild.textContent = "";
     20  });
     21  await onReorder;
     22 
     23  tree = { role, children: [] };
     24  testAccessibleTree(accessible, tree);
     25 }
     26 
     27 addAccessibleTask(
     28  `
     29  <p id="p">text</p>
     30  <pre id="pre">text</pre>`,
     31  async function (browser, accDoc) {
     32    let p = findAccessibleChildByID(accDoc, "p");
     33    let pre = findAccessibleChildByID(accDoc, "pre");
     34    await removeTextData(browser, p, "p", ROLE_PARAGRAPH);
     35    await removeTextData(browser, pre, "pre", ROLE_TEXT_CONTAINER);
     36  },
     37  { iframe: true, remoteIframe: true }
     38 );