tor-browser

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

browser_fontinspector_text-node.js (1069B)


      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 selecting a text node invokes the font editor on its parent node.
      7 
      8 const TEST_URI = URL_ROOT + "doc_browser_fontinspector.html";
      9 
     10 add_task(async function () {
     11  const { inspector, view } = await openFontInspectorForURL(TEST_URI);
     12  const viewDoc = view.document;
     13 
     14  info("Select the first text node of <body>");
     15  const bodyNode = await getNodeFront("body", inspector);
     16  const { nodes } = await inspector.walker.children(bodyNode);
     17  const onInspectorUpdated = inspector.once("fontinspector-updated");
     18  info("Select the text node");
     19  await selectNode(nodes[0], inspector);
     20 
     21  info("Waiting for font editor to render");
     22  await onInspectorUpdated;
     23 
     24  const textFonts = getUsedFontsEls(viewDoc);
     25 
     26  info("Select the <body> element");
     27  await selectNode("body", inspector);
     28 
     29  const parentFonts = getUsedFontsEls(viewDoc);
     30  is(
     31    textFonts.length,
     32    parentFonts.length,
     33    "Font inspector shows same number of fonts"
     34  );
     35 });