fune/browser/components/customizableui/test/browser_reset_builtin_widget_currentArea.js
Mike Conley 42a671591b Bug 1797836 - Part 2: Update CUI to have a general TYPE_PANEL instead of TYPE_MENU_PANEL. r=desktop-theme-reviewers,dao,sclements
Long ago, the menu panel in was a customizable area that users could drag things into.

That changed back around 2017 in bug 1354117 when the Photon redesign was built. The
menu panel become a static menu, but we also made it possible to permanently move things
to the overflow panel of the nav-bar.

It looks like we never updated the area type constant from referring to the old menu panel
though, so it's "TYPE_MENU_PANEL", and registering a node for it happens with
registerMenuPanel. This patch changes to constant to TYPE_PANEL and updates the registration
method to registerPanelNode.

I a check around the codebase as well as GitHub looking to see if there were any
system add-ons or experimental WebExtensions that rely on TYPE_MENU_PANEL / registerMenuPanel,
but I couldn't find any.

Differential Revision: https://phabricator.services.mozilla.com/D161078
2022-11-08 14:51:40 +00:00

26 lines
889 B
JavaScript

/* Any copyright is dedicated to the Public Domain.
* https://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
// Check that if we move a non-default, but builtin, widget to another area,
// and then reset things, the currentArea is updated correctly.
add_task(async function reset_should_not_keep_currentArea() {
CustomizableUI.addWidgetToArea(
"save-page-button",
CustomizableUI.AREA_FIXED_OVERFLOW_PANEL
);
// We can't check currentArea directly; check areaType which is based on it:
is(
CustomizableUI.getWidget("save-page-button").areaType,
CustomizableUI.TYPE_PANEL,
"Button should know it's in the overflow panel"
);
CustomizableUI.reset();
ok(
!CustomizableUI.getWidget("save-page-button").areaType,
"Button should know it's not in the overflow panel anymore"
);
});
registerCleanupFunction(() => CustomizableUI.reset());