mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1056035 - Hide the separator if there are no visible items above it. r=Unfocused
This commit is contained in:
parent
42346ce81a
commit
f0ea4a8120
@ -437,16 +437,19 @@ var gEventManager = {
|
||||
contextMenu.setAttribute("addontype", addon.type);
|
||||
|
||||
var menuSep = document.getElementById("addonitem-menuseparator");
|
||||
var countEnabledMenuCmds = 0;
|
||||
var countMenuItemsBeforeSep = 0;
|
||||
for (let child of contextMenu.children) {
|
||||
if (child == menuSep) {
|
||||
break;
|
||||
}
|
||||
if (child.nodeName == "menuitem" &&
|
||||
gViewController.isCommandEnabled(child.command)) {
|
||||
countEnabledMenuCmds++;
|
||||
countMenuItemsBeforeSep++;
|
||||
}
|
||||
}
|
||||
|
||||
// with only one menu item, we hide the menu separator
|
||||
menuSep.hidden = (countEnabledMenuCmds <= 1);
|
||||
// Hide the separator if there are no visible menu items before it
|
||||
menuSep.hidden = (countMenuItemsBeforeSep == 0);
|
||||
|
||||
}, false);
|
||||
},
|
||||
|
@ -197,6 +197,21 @@ add_task(function* testInstalledDetails() {
|
||||
el = doc.getElementById("detail-warning");
|
||||
is_element_hidden(el, "Warning notification is hidden.");
|
||||
el = doc.getElementsByTagName("setting")[0];
|
||||
|
||||
let contextMenu = doc.getElementById("addonitem-popup");
|
||||
let deferred = Promise.defer();
|
||||
let listener = () => {
|
||||
contextMenu.removeEventListener("popupshown", listener, false);
|
||||
deferred.resolve();
|
||||
};
|
||||
contextMenu.addEventListener("popupshown", listener, false);
|
||||
el = doc.getElementsByClassName("detail-view-container")[0];
|
||||
EventUtils.synthesizeMouse(el, 4, 4, { }, gManagerWindow);
|
||||
EventUtils.synthesizeMouse(el, 4, 4, { type: "contextmenu", button: 2 }, gManagerWindow);
|
||||
yield deferred.promise;
|
||||
let menuSep = doc.getElementById("addonitem-menuseparator");
|
||||
is_element_hidden(menuSep, "Menu separator is hidden.");
|
||||
contextMenu.hidePopup();
|
||||
});
|
||||
|
||||
add_task(function* testPreferencesButton() {
|
||||
|
Loading…
Reference in New Issue
Block a user