tor-browser

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

browser_jsterm_context_menu_labels.js (1136B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Tests that context menu for CodeMirror is properly localized.
      5 
      6 "use strict";
      7 
      8 const TEST_URI = `data:text/html;charset=utf8,<!DOCTYPE html><p>test page</p>`;
      9 
     10 add_task(async function () {
     11  const hud = await openNewTabAndConsole(TEST_URI);
     12  const { jsterm } = hud;
     13 
     14  const toolbox = gDevTools.getToolboxForTab(gBrowser.selectedTab);
     15 
     16  // Open context menu and wait until it's visible
     17  const element = jsterm.node.querySelector(".CodeMirror-wrap");
     18  const menuPopup = await openTextBoxContextMenu(toolbox, element);
     19 
     20  // Check label of the 'undo' menu item.
     21  const undoMenuItem = menuPopup.querySelector("#editmenu-undo");
     22  await waitUntil(() => !!undoMenuItem.getAttribute("label"));
     23 
     24  is(
     25    undoMenuItem.getAttribute("label"),
     26    "Undo",
     27    "Undo is visible and localized"
     28  );
     29 });
     30 
     31 async function openTextBoxContextMenu(toolbox, element) {
     32  const onConsoleMenuOpened = toolbox.once("menu-open");
     33  synthesizeContextMenuEvent(element);
     34  await onConsoleMenuOpened;
     35  return toolbox.getTextBoxContextMenu();
     36 }