mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1801678 - Test that pinning a browser action to an overflowed toolbar puts the widget in the right area. r=willdurand
Differential Revision: https://phabricator.services.mozilla.com/D162588
This commit is contained in:
parent
2fbb503a24
commit
4de19bba60
@ -947,3 +947,51 @@ add_task(async function test_action_button() {
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
||||
/**
|
||||
* Tests that if we pin a browser action button listed in the addons panel
|
||||
* to the toolbar when that button would immediately overflow, that the
|
||||
* button is put into the addons panel overflow list.
|
||||
*/
|
||||
add_task(async function test_pinning_to_toolbar_when_overflowed() {
|
||||
let win = await promiseEnableUnifiedExtensions();
|
||||
let movedNode;
|
||||
let extensionWidgetID;
|
||||
|
||||
await withWindowOverflowed(win, {
|
||||
beforeOverflowed: async extensionIDs => {
|
||||
// Before we overflow the toolbar, let's move the last item to the addons
|
||||
// panel.
|
||||
extensionWidgetID = AppUiTestInternals.getBrowserActionWidgetId(
|
||||
extensionIDs.at(-1)
|
||||
);
|
||||
|
||||
movedNode = CustomizableUI.getWidget(extensionWidgetID).forWindow(win)
|
||||
.node;
|
||||
|
||||
CustomizableUI.addWidgetToArea(
|
||||
extensionWidgetID,
|
||||
CustomizableUI.AREA_ADDONS
|
||||
);
|
||||
},
|
||||
whenOverflowed: async (defaultList, unifiedExtensionList, extensionIDs) => {
|
||||
// Now that the window is overflowed, let's move the widget in the addons
|
||||
// panel back to the navbar. This should cause the widget to overflow back
|
||||
// into the addons panel.
|
||||
CustomizableUI.addWidgetToArea(
|
||||
extensionWidgetID,
|
||||
CustomizableUI.AREA_NAVBAR
|
||||
);
|
||||
await TestUtils.waitForCondition(() => {
|
||||
return movedNode.hasAttribute("overflowedItem");
|
||||
});
|
||||
Assert.equal(
|
||||
movedNode.parentElement,
|
||||
unifiedExtensionList,
|
||||
"Should have overflowed the extension button to the right list."
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
await BrowserTestUtils.closeWindow(win);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user