tor-browser

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

browser_inspector_invalidate.js (1346B)


      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 highlighter handles geometry changes correctly.
      7 
      8 const TEST_URI =
      9  "data:text/html;charset=utf-8," +
     10  "browser_inspector_invalidate.js\n" +
     11  '<div style="width: 100px; height: 100px; background:yellow;"></div>';
     12 
     13 add_task(async function () {
     14  const { inspector, highlighterTestFront } =
     15    await openInspectorForURL(TEST_URI);
     16  const divFront = await getNodeFront("div", inspector);
     17 
     18  info("Waiting for highlighter to activate");
     19  await inspector.highlighters.showHighlighterTypeForNode(
     20    inspector.highlighters.TYPES.BOXMODEL,
     21    divFront
     22  );
     23 
     24  let rect = await highlighterTestFront.getSimpleBorderRect();
     25  is(rect.width, 100, "The highlighter has the right width.");
     26 
     27  info(
     28    "Changing the test element's size and waiting for the highlighter " +
     29      "to update"
     30  );
     31  await highlighterTestFront.changeHighlightedNodeWaitForUpdate(
     32    "style",
     33    "width: 200px; height: 100px; background:yellow;"
     34  );
     35 
     36  rect = await highlighterTestFront.getSimpleBorderRect();
     37  is(rect.width, 200, "The highlighter has the right width after update");
     38 
     39  info("Waiting for highlighter to hide");
     40  await inspector.highlighters.hideHighlighterType(
     41    inspector.highlighters.TYPES.BOXMODEL
     42  );
     43 });