mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 702342 - Filter Button should remain popped up when unchecking a suboption if any of the other suboptions remain checked. r=msucan
This commit is contained in:
parent
c640e09835
commit
4de902e4ee
@ -6290,18 +6290,17 @@ HeadsUpDisplayUICommands = {
|
|||||||
// Adjust the state of the button appropriately.
|
// Adjust the state of the button appropriately.
|
||||||
let menuPopup = this.parentNode;
|
let menuPopup = this.parentNode;
|
||||||
|
|
||||||
let allChecked = true;
|
let someChecked = false;
|
||||||
let menuItem = menuPopup.firstChild;
|
let menuItem = menuPopup.firstChild;
|
||||||
while (menuItem) {
|
while (menuItem) {
|
||||||
if (menuItem.getAttribute("checked") !== "true") {
|
if (menuItem.getAttribute("checked") === "true") {
|
||||||
allChecked = false;
|
someChecked = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
menuItem = menuItem.nextSibling;
|
menuItem = menuItem.nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
let toolbarButton = menuPopup.parentNode;
|
let toolbarButton = menuPopup.parentNode;
|
||||||
toolbarButton.setAttribute("checked", allChecked);
|
toolbarButton.setAttribute("checked", someChecked);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,17 +59,17 @@ function testMenuFilterButton(aCategory) {
|
|||||||
ok(isChecked(button), "the button for category " + aCategory + " is " +
|
ok(isChecked(button), "the button for category " + aCategory + " is " +
|
||||||
"checked after turning on all its menu items");
|
"checked after turning on all its menu items");
|
||||||
|
|
||||||
// Turn one filter off; make sure the button is no longer checked.
|
// Turn one filter off; make sure the button is still checked.
|
||||||
prefKey = firstMenuItem.getAttribute("prefKey");
|
prefKey = firstMenuItem.getAttribute("prefKey");
|
||||||
chooseMenuItem(firstMenuItem);
|
chooseMenuItem(firstMenuItem);
|
||||||
ok(!isChecked(firstMenuItem), "the first menu item for category " +
|
ok(!isChecked(firstMenuItem), "the first menu item for category " +
|
||||||
aCategory + " is no longer checked after clicking it");
|
aCategory + " is no longer checked after clicking it");
|
||||||
ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
|
ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
|
||||||
"turned off after clicking the appropriate menu item");
|
"turned off after clicking the appropriate menu item");
|
||||||
ok(!isChecked(button), "the button for category " + aCategory + " is no " +
|
ok(isChecked(button), "the button for category " + aCategory + " is still " +
|
||||||
"longer checked after turning off its first menu item");
|
"checked after turning off its first menu item");
|
||||||
|
|
||||||
// Turn all the filters on by clicking the main part of the button.
|
// Turn all the filters off by clicking the main part of the button.
|
||||||
let anonymousNodes = document.getAnonymousNodes(button);
|
let anonymousNodes = document.getAnonymousNodes(button);
|
||||||
let subbutton;
|
let subbutton;
|
||||||
for (let i = 0; i < anonymousNodes.length; i++) {
|
for (let i = 0; i < anonymousNodes.length; i++) {
|
||||||
@ -82,6 +82,22 @@ function testMenuFilterButton(aCategory) {
|
|||||||
ok(subbutton, "we have the subbutton for category " + aCategory);
|
ok(subbutton, "we have the subbutton for category " + aCategory);
|
||||||
|
|
||||||
clickButton(subbutton);
|
clickButton(subbutton);
|
||||||
|
ok(!isChecked(button), "the button for category " + aCategory + " is " +
|
||||||
|
"no longer checked after clicking its main part");
|
||||||
|
|
||||||
|
menuItem = firstMenuItem;
|
||||||
|
while (menuItem) {
|
||||||
|
let prefKey = menuItem.getAttribute("prefKey");
|
||||||
|
ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
|
||||||
|
aCategory + " is no longer checked after clicking the button");
|
||||||
|
ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
|
||||||
|
"off after clicking the button");
|
||||||
|
menuItem = menuItem.nextSibling;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Turn all the filters on by clicking the main part of the button.
|
||||||
|
clickButton(subbutton);
|
||||||
|
|
||||||
ok(isChecked(button), "the button for category " + aCategory + " is " +
|
ok(isChecked(button), "the button for category " + aCategory + " is " +
|
||||||
"checked after clicking its main part");
|
"checked after clicking its main part");
|
||||||
|
|
||||||
@ -95,21 +111,16 @@ function testMenuFilterButton(aCategory) {
|
|||||||
menuItem = menuItem.nextSibling;
|
menuItem = menuItem.nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Turn all the filters off by clicking the main part of the button.
|
// Uncheck the main button by unchecking all the filters
|
||||||
clickButton(subbutton);
|
|
||||||
ok(!isChecked(subbutton), "the button for category " + aCategory + " is " +
|
|
||||||
"no longer checked after clicking it");
|
|
||||||
|
|
||||||
menuItem = firstMenuItem;
|
menuItem = firstMenuItem;
|
||||||
while (menuItem) {
|
while (menuItem) {
|
||||||
let prefKey = menuItem.getAttribute("prefKey");
|
chooseMenuItem(menuItem);
|
||||||
ok(!isChecked(menuItem), "menu item " + prefKey + " for category " +
|
|
||||||
aCategory + " is no longer checked after clicking the button");
|
|
||||||
ok(!HUDService.filterPrefs[hudId][prefKey], prefKey + " messages are " +
|
|
||||||
"off after clicking the button");
|
|
||||||
menuItem = menuItem.nextSibling;
|
menuItem = menuItem.nextSibling;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ok(!isChecked(button), "the button for category " + aCategory + " is " +
|
||||||
|
"unchecked after unchecking all its filters");
|
||||||
|
|
||||||
// Turn all the filters on again by clicking the button.
|
// Turn all the filters on again by clicking the button.
|
||||||
clickButton(subbutton);
|
clickButton(subbutton);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user