зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1700503, insert enterprise policy support menu item to app menu r=mkaply
Differential Revision: https://phabricator.services.mozilla.com/D109569
This commit is contained in:
Родитель
829131f372
Коммит
993984618c
|
@ -687,7 +687,15 @@ const PanelUI = {
|
|||
|
||||
let helpMenu = document.getElementById("menu_HelpPopup");
|
||||
let items = this.getElementsByTagName("vbox")[0];
|
||||
let attrs = ["command", "oncommand", "onclick", "key", "disabled"];
|
||||
let attrs = [
|
||||
"command",
|
||||
"oncommand",
|
||||
"onclick",
|
||||
"key",
|
||||
"disabled",
|
||||
"accesskey",
|
||||
"label",
|
||||
];
|
||||
|
||||
// Remove all buttons from the view
|
||||
while (items.firstChild) {
|
||||
|
@ -715,7 +723,9 @@ const PanelUI = {
|
|||
// We have AppMenu-specific strings for the Help menu. By convention,
|
||||
// their localization IDs are set on "appmenu-data-l10n-id" attributes.
|
||||
let l10nId = node.getAttribute("appmenu-data-l10n-id");
|
||||
button.setAttribute("data-l10n-id", l10nId);
|
||||
if (l10nId) {
|
||||
button.setAttribute("data-l10n-id", l10nId);
|
||||
}
|
||||
|
||||
if (node.id) {
|
||||
button.id = "appMenu_" + node.id;
|
||||
|
@ -732,6 +742,20 @@ const PanelUI = {
|
|||
}
|
||||
fragment.appendChild(button);
|
||||
}
|
||||
|
||||
// The Enterprise Support menu item has a different location than its
|
||||
// placement in the menubar, so we need to specify it here.
|
||||
let helpPolicySupport = fragment.querySelector(
|
||||
"#appMenu_helpPolicySupport"
|
||||
);
|
||||
if (helpPolicySupport) {
|
||||
fragment.insertBefore(
|
||||
helpPolicySupport,
|
||||
fragment.querySelector("#appMenu_menu_HelpPopup_reportPhishingtoolmenu")
|
||||
.nextSibling
|
||||
);
|
||||
}
|
||||
|
||||
items.appendChild(fragment);
|
||||
},
|
||||
|
||||
|
|
|
@ -34,3 +34,36 @@ add_task(async function test_help_menu() {
|
|||
"The policy menu should have the correct access key."
|
||||
);
|
||||
});
|
||||
|
||||
add_task(async function test_help_menu_app_menu() {
|
||||
is(
|
||||
Services.policies.getSupportMenu().URL.href,
|
||||
"https://example.com/",
|
||||
"The policy should have the correct URL."
|
||||
);
|
||||
let menuButton = document.getElementById("PanelUI-menu-button");
|
||||
menuButton.click();
|
||||
await BrowserTestUtils.waitForEvent(window.PanelUI.mainView, "ViewShown");
|
||||
|
||||
let helpButtonId = PanelUI.protonAppMenuEnabled
|
||||
? "appMenu-help-button2"
|
||||
: "appMenu-help-button";
|
||||
document.getElementById(helpButtonId).click();
|
||||
await BrowserTestUtils.waitForEvent(
|
||||
document.getElementById("PanelUI-helpView"),
|
||||
"ViewShown"
|
||||
);
|
||||
|
||||
let supportMenu = document.getElementById("appMenu_helpPolicySupport");
|
||||
is(supportMenu.hidden, false, "The policy menu should be visible.");
|
||||
is(
|
||||
supportMenu.getAttribute("label"),
|
||||
"Title",
|
||||
"The policy menu should have the correct title."
|
||||
);
|
||||
is(
|
||||
supportMenu.getAttribute("accesskey"),
|
||||
"T",
|
||||
"The policy menu should have the correct access key."
|
||||
);
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче