tor-browser

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

browser_fontinspector_copy-URL.js (983B)


      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 an icon appears next to web font URLs, and that clicking it copies the URL
      7 // to the clipboard thanks to it.
      8 
      9 const TEST_URI = URL_ROOT + "doc_browser_fontinspector.html";
     10 
     11 add_task(async function () {
     12  const { view, inspector } = await openFontInspectorForURL(TEST_URI);
     13  const viewDoc = view.document;
     14  await selectNode("div", inspector);
     15  await expandFontsAccordion(viewDoc);
     16  const allFontsEls = getAllFontsEls(viewDoc);
     17  const fontEl = allFontsEls[0];
     18 
     19  const linkEl = fontEl.querySelector(".font-origin");
     20  const iconEl = linkEl.querySelector(".copy-icon");
     21 
     22  ok(iconEl, "The icon is displayed");
     23  is(iconEl.getAttribute("title"), "Copy URL", "This is the right icon");
     24 
     25  info("Clicking the button and waiting for the clipboard to receive the URL");
     26  await waitForClipboardPromise(() => iconEl.click(), linkEl.textContent);
     27 });