tor-browser

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

browser_markup_anonymous_03.js (1543B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test shadow DOM content in the markupview.
      7 // Note that many features are not yet enabled, but basic listing
      8 // of elements should be working.
      9 const TEST_URL = URL_ROOT + "doc_markup_anonymous.html";
     10 
     11 add_task(async function () {
     12  const { inspector } = await openInspectorForURL(TEST_URL);
     13 
     14  const shadowHostFront = await getNodeFront("#shadow", inspector.markup);
     15  is(shadowHostFront.numChildren, 3, "Children of the shadow host are correct");
     16 
     17  await inspector.markup.expandNode(shadowHostFront);
     18  await waitForMultipleChildrenUpdates(inspector);
     19 
     20  const shadowContainer = inspector.markup.getContainer(shadowHostFront);
     21  const containers = shadowContainer.getChildContainers();
     22 
     23  info("Checking the ::before pseudo element");
     24  const before = containers[1].node;
     25  await isEditingMenuDisabled(before, inspector);
     26 
     27  info("Checking shadow dom children");
     28  const shadowRootFront = containers[0].node;
     29  const children = await inspector.walker.children(shadowRootFront);
     30 
     31  is(shadowRootFront.numChildren, 2, "Children of the shadow root are counted");
     32  is(children.nodes.length, 2, "Children returned from walker");
     33 
     34  info("Checking the <h3> shadow element");
     35  const shadowChild1 = children.nodes[0];
     36  await isEditingMenuEnabled(shadowChild1, inspector);
     37 
     38  info("Checking the <select> shadow element");
     39  const shadowChild2 = children.nodes[1];
     40  await isEditingMenuEnabled(shadowChild2, inspector);
     41 });