tor-browser

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

browser_inspector_highlighter-01.js (1451B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 // Test that hovering over nodes in the markup-view shows the highlighter over
      8 // those nodes
      9 add_task(async function () {
     10  info("Loading the test document and opening the inspector");
     11  const { inspector, highlighterTestFront } = await openInspectorForURL(
     12    "data:text/html;charset=utf-8,<h1>foo</h1><span>bar</span>"
     13  );
     14  const { waitForHighlighterTypeShown } = getHighlighterTestHelpers(inspector);
     15 
     16  let isVisible = !!inspector.highlighters.getActiveHighlighter(
     17    inspector.highlighters.TYPES.BOXMODEL
     18  );
     19  ok(!isVisible, "The highlighter is hidden by default");
     20 
     21  info("Selecting the test node");
     22  await selectNode("span", inspector);
     23  const container = await getContainerForSelector("h1", inspector);
     24 
     25  const onHighlight = waitForHighlighterTypeShown(
     26    inspector.highlighters.TYPES.BOXMODEL
     27  );
     28 
     29  EventUtils.synthesizeMouseAtCenter(
     30    container.tagLine,
     31    { type: "mousemove" },
     32    inspector.markup.doc.defaultView
     33  );
     34  await onHighlight;
     35 
     36  isVisible = await highlighterTestFront.isHighlighting();
     37  ok(isVisible, "The highlighter is shown on a markup container hover");
     38 
     39  ok(
     40    await highlighterTestFront.assertHighlightedNode("h1"),
     41    "The highlighter highlights the right node"
     42  );
     43 });