Bug 1633946 - Add tooltip to List All Tabs r=mconley

Differential Revision: https://phabricator.services.mozilla.com/D183102
This commit is contained in:
Danny Colin 2023-07-31 13:54:31 +00:00
Родитель 12f5099c54
Коммит d13aa67b74
2 изменённых файлов: 42 добавлений и 0 удалений

Просмотреть файл

@ -106,3 +106,43 @@ add_task(async function () {
BrowserTestUtils.removeTab(tab);
});
// This test verifies that the tooltip in the tab manager panel matches the
// tooltip in the tab strip.
add_task(async function () {
// Open a new tab
const tabUrl = "https://example.com";
let tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, tabUrl);
// Make the popup of allTabs showing up
gTabsPanel.init();
let allTabsView = document.getElementById("allTabsMenu-allTabsView");
let allTabsPopupShownPromise = BrowserTestUtils.waitForEvent(
allTabsView,
"ViewShown"
);
gTabsPanel.showAllTabsPanel();
await allTabsPopupShownPromise;
// Get tooltips and compare them
let tabInPanel = Array.from(
gTabsPanel.allTabsViewTabs.querySelectorAll(".all-tabs-button")
).at(-1).label;
let tabInTabStrip = tab.getAttribute("label");
is(
tabInPanel,
tabInTabStrip,
"Tooltip in tab manager panel matches tooltip in tab strip"
);
// Close everything
let allTabsPopupHiddenPromise = BrowserTestUtils.waitForEvent(
allTabsView.panelMultiView,
"PanelMultiViewHidden"
);
gTabsPanel.hideAllTabsPanel();
await allTabsPopupHiddenPromise;
BrowserTestUtils.removeTab(tab);
});

Просмотреть файл

@ -358,11 +358,13 @@ export class TabsPanel extends TabsListBase {
_setRowAttributes(row, tab) {
setAttributes(row, { selected: tab.selected });
let tooltiptext = this.gBrowser.getTabTooltip(tab);
let busy = tab.getAttribute("busy");
let button = row.firstElementChild;
setAttributes(button, {
busy,
label: tab.label,
tooltiptext,
image: !busy && tab.getAttribute("image"),
iconloadingprincipal: tab.getAttribute("iconloadingprincipal"),
});