tor-browser

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

browser_markup_toggle_04.js (1330B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test expanding elements by clicking on expand badge.
      7 
      8 const TEST_URL = URL_ROOT + "doc_markup_toggle.html";
      9 
     10 add_task(async function () {
     11  const { inspector } = await openInspectorForURL(TEST_URL);
     12 
     13  info("Getting the container for the UL parent element");
     14  const container = await getContainerForSelector("ul", inspector);
     15  ok(!container.mustExpand, "UL element !mustExpand");
     16  ok(container.canExpand, "UL element canExpand");
     17 
     18  info("Clicking on the UL parent expand badge, and waiting for children");
     19  const onChildren = waitForChildrenUpdated(inspector);
     20  const onUpdated = inspector.once("inspector-updated");
     21 
     22  EventUtils.synthesizeMouseAtCenter(
     23    container.editor.expandBadge,
     24    {},
     25    inspector.markup.doc.defaultView
     26  );
     27  await onChildren;
     28  await onUpdated;
     29 
     30  info("Checking that child LI elements have been created");
     31  const numLi = await getNumberOfMatchingElementsInContentPage("li");
     32  for (let i = 0; i < numLi; i++) {
     33    const liContainer = await getContainerForSelector(
     34      `li:nth-child(${i + 1})`,
     35      inspector
     36    );
     37    ok(liContainer, "A container for the child LI element was created");
     38  }
     39  ok(container.expanded, "Parent UL container is expanded");
     40 });