Commit d470cff4 authored by Emma Malysz's avatar Emma Malysz
Browse files

Bug 1662183, hide fxa button from main menu when identity.fxaccounts.enabled...

Bug 1662183, hide fxa button from main menu when identity.fxaccounts.enabled is false r=Gijs,mkaply a=RyanVM

Differential Revision: https://phabricator.services.mozilla.com/D88946
parent c4c6fa11
......@@ -1573,6 +1573,8 @@ var gSync = {
},
onFxaDisabled() {
document.documentElement.setAttribute("fxadisabled", true);
const toHide = [...document.querySelectorAll(".sync-ui-item")];
for (const item of toHide) {
item.hidden = true;
......
......@@ -328,6 +328,37 @@ add_task(async function test_account_settings_state_signedin() {
await closeTabAndMainPanel();
});
add_task(async function test_app_menu_fxa_disabled() {
const newWin = await BrowserTestUtils.openNewBrowserWindow();
Services.prefs.setBoolPref("identity.fxaccounts.enabled", true);
newWin.gSync.onFxaDisabled();
let menuButton = newWin.document.getElementById("PanelUI-menu-button");
menuButton.click();
await BrowserTestUtils.waitForEvent(newWin.PanelUI.mainView, "ViewShown");
ok(
BrowserTestUtils.is_hidden(
newWin.document.getElementById("appMenu-fxa-status")
),
"Fxa status is hidden"
);
[...newWin.document.querySelectorAll(".sync-ui-item")].forEach(
e => (e.hidden = false)
);
let mainView = newWin.document.getElementById("appMenu-mainView");
let hidden = BrowserTestUtils.waitForEvent(
newWin.document,
"popuphidden",
true
);
mainView.closest("panel").hidePopup();
await hidden;
await BrowserTestUtils.closeWindow(newWin);
});
function checkPanelUIStatusBar({ label, fxastatus, syncing }) {
let labelNode = document.getElementById("appMenu-fxa-label");
is(labelNode.getAttribute("label"), label, "fxa label has the right value");
......
......@@ -581,6 +581,10 @@ toolbarbutton[constrain-size="true"][cui-areatype="menu-panel"] > .toolbarbutton
-moz-box-align: center;
}
:root[fxadisabled=true] #appMenu-fxa-status {
display: none;
}
#appMenu-fxa-avatar,
#fxa-menu-account-fxa-avatar {
pointer-events: none;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment