tor-browser

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

browser_inspector_delete-selected-node-01.js (885B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test to ensure inspector handles deletion of selected node correctly.
      6 
      7 const TEST_URL = URL_ROOT + "doc_inspector_delete-selected-node-01.html";
      8 
      9 add_task(async function () {
     10  const { inspector } = await openInspectorForURL(TEST_URL);
     11 
     12  const spanNodeFront = await getNodeFrontInFrames(
     13    ["iframe", "span"],
     14    inspector
     15  );
     16  await selectNode(spanNodeFront, inspector);
     17 
     18  info("Removing selected <span> element.");
     19  const parentNode = spanNodeFront.parentNode();
     20  await spanNodeFront.inspectorFront.walker.removeNode(spanNodeFront);
     21 
     22  // Wait for the inspector to process the mutation
     23  await inspector.once("inspector-updated");
     24  is(
     25    inspector.selection.nodeFront,
     26    parentNode,
     27    "Parent node of selected <span> got selected."
     28  );
     29 });