tor-browser

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

browser_inspector_highlighter-hover_02.js (1608B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 // Test that when after an element is selected and highlighted on hover, if the
      7 // mouse leaves the markup-view and comes back again on the same element, that
      8 // the highlighter is shown again on the node
      9 
     10 const TEST_URL = "data:text/html;charset=utf-8,<p>Select me!</p>";
     11 
     12 add_task(async function () {
     13  const { inspector, highlighterTestFront } =
     14    await openInspectorForURL(TEST_URL);
     15  const { waitForHighlighterTypeHidden } = getHighlighterTestHelpers(inspector);
     16 
     17  info(
     18    "hover over the <p> line in the markup-view so that it's the " +
     19      "currently hovered node"
     20  );
     21  await hoverContainer("p", inspector);
     22 
     23  info("select the <p> markup-container line by clicking");
     24  await clickContainer("p", inspector);
     25  let isVisible = await highlighterTestFront.isHighlighting();
     26  ok(isVisible, "the highlighter is shown");
     27 
     28  const onHidden = waitForHighlighterTypeHidden(
     29    inspector.highlighters.TYPES.BOXMODEL
     30  );
     31  info("mouse-leave the markup-view");
     32  await mouseLeaveMarkupView(inspector);
     33  info("listen to the highlighter's hidden event");
     34  await onHidden;
     35  info("check that the highlighter is no longer visible");
     36  isVisible = await highlighterTestFront.isHighlighting();
     37  ok(!isVisible, "the highlighter is hidden after mouseleave");
     38 
     39  info("hover over the <p> line again, which is still selected");
     40  await hoverContainer("p", inspector);
     41  isVisible = await highlighterTestFront.isHighlighting();
     42  ok(isVisible, "the highlighter is visible again");
     43 });