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