tor-browser

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

browser_inspector_breadcrumbs_highlight_hover.js (2258B)


      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 on the breadcrumb buttons in the inspector
      8 // shows the highlighter over 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, waitForHighlighterTypeHidden } =
     15    getHighlighterTestHelpers(inspector);
     16 
     17  info("Selecting the test node");
     18  await selectNode("span", inspector);
     19  const bcButtons = inspector.breadcrumbs.container;
     20 
     21  let onNodeHighlighted = waitForHighlighterTypeShown(
     22    inspector.highlighters.TYPES.BOXMODEL
     23  );
     24  let button = bcButtons.childNodes[1];
     25  EventUtils.synthesizeMouseAtCenter(
     26    button,
     27    { type: "mousemove" },
     28    button.ownerDocument.defaultView
     29  );
     30  await onNodeHighlighted;
     31 
     32  let isVisible = await highlighterTestFront.isHighlighting();
     33  ok(isVisible, "The highlighter is shown on a markup container hover");
     34 
     35  ok(
     36    await highlighterTestFront.assertHighlightedNode("body"),
     37    "The highlighter highlights the right node"
     38  );
     39 
     40  const onNodeUnhighlighted = waitForHighlighterTypeHidden(
     41    inspector.highlighters.TYPES.BOXMODEL
     42  );
     43  // move outside of the breadcrumb trail to trigger unhighlight
     44  EventUtils.synthesizeMouseAtCenter(
     45    inspector.addNodeButton,
     46    { type: "mousemove" },
     47    inspector.addNodeButton.ownerDocument.defaultView
     48  );
     49  await onNodeUnhighlighted;
     50 
     51  onNodeHighlighted = waitForHighlighterTypeShown(
     52    inspector.highlighters.TYPES.BOXMODEL
     53  );
     54  button = bcButtons.childNodes[2];
     55  EventUtils.synthesizeMouseAtCenter(
     56    button,
     57    { type: "mousemove" },
     58    button.ownerDocument.defaultView
     59  );
     60  await onNodeHighlighted;
     61 
     62  isVisible = await highlighterTestFront.isHighlighting();
     63  ok(isVisible, "The highlighter is shown on a markup container hover");
     64 
     65  ok(
     66    await highlighterTestFront.assertHighlightedNode("span"),
     67    "The highlighter highlights the right node"
     68  );
     69 });