tor-browser

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

browser_styleeditor_loading.js (1360B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 "use strict";
      4 
      5 // Test that style editor loads correctly.
      6 
      7 const TESTCASE_URI = TEST_BASE_HTTPS + "longload.html";
      8 
      9 add_task(async function () {
     10  // launch Style Editor right when the tab is created (before load)
     11  // this checks that the Style Editor still launches correctly when it is
     12  // opened *while* the page is still loading. The Style Editor should not
     13  // signal that it is loaded until the accompanying content page is loaded.
     14  const tabAdded = addTab(TESTCASE_URI);
     15  const tab = gBrowser.selectedTab;
     16  const styleEditorLoaded = gDevTools.showToolboxForTab(tab, {
     17    toolId: "styleeditor",
     18  });
     19 
     20  await Promise.all([tabAdded, styleEditorLoaded]);
     21 
     22  const toolbox = gDevTools.getToolboxForTab(tab);
     23  const panel = toolbox.getPanel("styleeditor");
     24  const { panelWindow } = panel;
     25 
     26  ok(
     27    !getRootElement(panel).classList.contains("loading"),
     28    "style editor root element does not have 'loading' class name anymore"
     29  );
     30 
     31  let button = panelWindow.document.querySelector(".style-editor-newButton");
     32  ok(!button.hasAttribute("disabled"), "new style sheet button is enabled");
     33 
     34  button = panelWindow.document.querySelector(".style-editor-importButton");
     35  ok(!button.hasAttribute("disabled"), "import button is enabled");
     36 });