1
0
Fork 0
firefox/browser/components/customizableui/test/browser_sidebar_button_reset.js
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

54 lines
1.7 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
registerCleanupFunction(async () => {
await SpecialPowers.popPrefEnv();
CustomizableUI.reset();
});
add_task(
async function reset_defaults_should_include_sidebar_button_in_revamp() {
ok(
!CustomizableUI.getPlacementOfWidget("sidebar-button"),
"Sidebar button is not in the nav bar initially"
);
CustomizableUI.addWidgetToArea("sidebar-button", "nav-bar");
is(
CustomizableUI.getPlacementOfWidget("sidebar-button").area,
CustomizableUI.AREA_NAVBAR,
"Sidebar button is in the nav bar"
);
CustomizableUI.removeWidgetFromArea("sidebar-button");
ok(
!CustomizableUI.getPlacementOfWidget("sidebar-button"),
"Sidebar button has been removed from the nav bar"
);
CustomizableUI.reset();
ok(
!CustomizableUI.getPlacementOfWidget("sidebar-button"),
"Sidebar button has not been restored to the nav bar"
);
await SpecialPowers.pushPrefEnv({
set: [["sidebar.revamp", true]],
});
is(
CustomizableUI.getPlacementOfWidget("sidebar-button").area,
CustomizableUI.AREA_NAVBAR,
"Sidebar button is in the nav bar when revamp pref is flipped"
);
CustomizableUI.removeWidgetFromArea("sidebar-button");
ok(
!CustomizableUI.getPlacementOfWidget("sidebar-button"),
"Sidebar button has been removed from the nav bar"
);
CustomizableUI.reset();
is(
CustomizableUI.getPlacementOfWidget("sidebar-button").area,
CustomizableUI.AREA_NAVBAR,
"Sidebar button has been restored to the nav bar"
);
}
);