Bug 1451592 - Simplify browser_toolbox_options_disable_buttons.js; r?jryans
Bug 1444301 moved the noautohide button to the meatball menu so we no longer to
worry about filtering it out in browser_toolbox_options_disable_buttons.js.
MozReview-Commit-ID: 5fp4FDxbc6o
--- a/devtools/client/framework/test/browser_toolbox_options_disable_buttons.js
+++ b/devtools/client/framework/test/browser_toolbox_options_disable_buttons.js
@@ -60,53 +60,43 @@ function testSelectTool(devtoolsToolbox)
return deferred.promise;
}
function testPreferenceAndUIStateIsConsistent() {
let checkNodes = [...panelWin.document.querySelectorAll(
"#enabled-toolbox-buttons-box input[type=checkbox]")];
let toolboxButtonNodes = [...doc.querySelectorAll(".command-button")];
- // The noautohide button is only displayed in the browser toolbox
- let toolbarButtons = toolbox.toolbarButtons.filter(
- tool => tool.id != "command-button-noautohide");
-
- for (let tool of toolbarButtons) {
+ for (let tool of toolbox.toolbarButtons) {
let isVisible = getBoolPref(tool.visibilityswitch);
let button = toolboxButtonNodes.find(toolboxButton => toolboxButton.id === tool.id);
is(!!button, isVisible,
"Button visibility matches pref for " + tool.id);
let check = checkNodes.filter(node => node.id === tool.id)[0];
is(check.checked, isVisible,
"Checkbox should be selected based on current pref for " + tool.id);
}
}
function testToggleToolboxButtons() {
let checkNodes = [...panelWin.document.querySelectorAll(
"#enabled-toolbox-buttons-box input[type=checkbox]")];
- // The noautohide button is only displayed in the browser toolbox, and the element
- // picker button is not toggleable.
- let toolbarButtons = toolbox.toolbarButtons.filter(
- tool => tool.id != "command-button-noautohide");
-
let visibleToolbarButtons = toolbox.toolbarButtons.filter(tool => tool.isVisible);
- let toolbarButtonNodes = [...doc.querySelectorAll(".command-button")].filter(
- btn => btn.id != "command-button-noautohide");
+ let toolbarButtonNodes = [...doc.querySelectorAll(".command-button")];
- is(checkNodes.length, toolbarButtons.length,
+ is(checkNodes.length, toolbox.toolbarButtons.length,
"All of the buttons are toggleable.");
is(visibleToolbarButtons.length, toolbarButtonNodes.length,
"All of the DOM buttons are toggleable.");
- for (let tool of toolbarButtons) {
+ for (let tool of toolbox.toolbarButtons) {
let id = tool.id;
let matchedCheckboxes = checkNodes.filter(node => node.id === id);
let matchedButtons = toolbarButtonNodes.filter(button => button.id === id);
is(matchedCheckboxes.length, 1,
"There should be a single toggle checkbox for: " + id);
if (tool.isVisible) {
is(matchedButtons.length, 1,
"There should be a DOM button for the visible: " + id);
@@ -117,24 +107,24 @@ function testToggleToolboxButtons() {
"There should not be a DOM button for the invisible: " + id);
}
is(matchedCheckboxes[0].nextSibling.textContent, tool.description,
"The label for checkbox matches the tool definition.");
}
// Store modified pref names so that they can be cleared on error.
- for (let tool of toolbarButtons) {
+ for (let tool of toolbox.toolbarButtons) {
let pref = tool.visibilityswitch;
modifiedPrefs.push(pref);
}
// Try checking each checkbox, making sure that it changes the preference
for (let node of checkNodes) {
- let tool = toolbarButtons.filter(
+ let tool = toolbox.toolbarButtons.filter(
commandButton => commandButton.id === node.id)[0];
let isVisible = getBoolPref(tool.visibilityswitch);
testPreferenceAndUIStateIsConsistent();
node.click();
testPreferenceAndUIStateIsConsistent();
let isVisibleAfterClick = getBoolPref(tool.visibilityswitch);