tor-browser

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

browser_inspector_highlighter-04.js (1543B)


      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 // Check that various highlighter elements exist.
      8 
      9 const TEST_URL = "data:text/html;charset=utf-8,<div>test</div>";
     10 
     11 // IDs of all highlighter elements that we expect to find in the canvasFrame.
     12 const ELEMENTS = [
     13  "box-model-root",
     14  "box-model-elements",
     15  "box-model-margin",
     16  "box-model-border",
     17  "box-model-padding",
     18  "box-model-content",
     19  "box-model-guide-top",
     20  "box-model-guide-right",
     21  "box-model-guide-bottom",
     22  "box-model-guide-left",
     23  "box-model-infobar-container",
     24  "box-model-infobar-tagname",
     25  "box-model-infobar-id",
     26  "box-model-infobar-classes",
     27  "box-model-infobar-pseudo-classes",
     28  "box-model-infobar-dimensions",
     29 ];
     30 
     31 add_task(async function () {
     32  const { inspector, highlighterTestFront } =
     33    await openInspectorForURL(TEST_URL);
     34 
     35  info("Show the box-model highlighter");
     36  const divFront = await getNodeFront("div", inspector);
     37  await inspector.highlighters.showHighlighterTypeForNode(
     38    inspector.highlighters.TYPES.BOXMODEL,
     39    divFront
     40  );
     41 
     42  for (const id of ELEMENTS) {
     43    const foundId = await highlighterTestFront.getHighlighterNodeAttribute(
     44      id,
     45      "id"
     46    );
     47    is(foundId, id, "Element " + id + " found");
     48  }
     49 
     50  info("Hide the box-model highlighter");
     51  await inspector.highlighters.hideHighlighterType(
     52    inspector.highlighters.TYPES.BOXMODEL
     53  );
     54 });