tor-browser

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

browser_dom_nodes_select.js (1379B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 const TEST_PAGE_URL = URL_ROOT + "page_dom_nodes.html";
      7 
      8 /**
      9 * Checks whether hovering nodes highlight them in the content page
     10 */
     11 add_task(async function () {
     12  info("Test DOM panel node highlight started");
     13 
     14  const { panel, tab } = await addTestTab(TEST_PAGE_URL);
     15  const toolbox = gDevTools.getToolboxForTab(tab);
     16  const node = getRowByIndex(panel, 0);
     17 
     18  // Loading the inspector panel at first, to make it possible to listen for
     19  // new node selections
     20 
     21  await toolbox.loadTool("inspector");
     22  const inspector = toolbox.getPanel("inspector");
     23 
     24  const openInInspectorIcon = node.querySelector(".open-inspector");
     25  Assert.notStrictEqual(node, null, "Node was logged as expected");
     26 
     27  info(
     28    "Clicking on the inspector icon and waiting for the " +
     29      "inspector to be selected"
     30  );
     31  const onInspectorSelected = toolbox.once("inspector-selected");
     32  const onInspectorUpdated = inspector.once("inspector-updated");
     33  const onNewNode = toolbox.selection.once("new-node-front");
     34 
     35  openInInspectorIcon.click();
     36 
     37  await onInspectorSelected;
     38  await onInspectorUpdated;
     39  const nodeFront = await onNewNode;
     40 
     41  ok(true, "Inspector selected and new node got selected");
     42  is(nodeFront.displayName, "h1", "The expected node was selected");
     43 });