tor-browser

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

browser_treeupdate_list_editabledoc.js (1294B)


      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 addAccessibleTask(
     11  '<ol id="list"></ol>',
     12  async function (browser, accDoc) {
     13    let list = findAccessibleChildByID(accDoc, "list");
     14 
     15    testAccessibleTree(list, {
     16      role: ROLE_LIST,
     17      children: [],
     18    });
     19 
     20    await invokeSetAttribute(
     21      browser,
     22      currentContentDoc(),
     23      "contentEditable",
     24      "true"
     25    );
     26    let onReorder = waitForEvent(EVENT_REORDER, "list");
     27    await invokeContentTask(browser, [], () => {
     28      let li = content.document.createElement("li");
     29      li.textContent = "item";
     30      content.document.getElementById("list").appendChild(li);
     31    });
     32    await onReorder;
     33 
     34    testAccessibleTree(list, {
     35      role: ROLE_LIST,
     36      children: [
     37        {
     38          role: ROLE_LISTITEM,
     39          children: [
     40            { role: ROLE_LISTITEM_MARKER, name: "1. ", children: [] },
     41            { role: ROLE_TEXT_LEAF, children: [] },
     42          ],
     43        },
     44      ],
     45    });
     46  },
     47  { iframe: true, remoteIframe: true }
     48 );