Bug 1341438. Part 2 - Update CUI tests to know how to handle an extra button in DevEdition. r=gijs
MozReview-Commit-ID: f7JKPDN7t8
--- a/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
+++ b/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
@@ -27,19 +27,17 @@ add_task(async function testWrapUnwrap()
// Creating and destroying a widget should correctly deal with panel placeholders
add_task(async function testPanelPlaceholders() {
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
// The value of expectedPlaceholders depends on the default palette layout.
// Bug 1229236 is for these tests to be smarter so the test doesn't need to
// change when the default placements change.
let expectedPlaceholders = 1;
- if (isInDevEdition()) {
- expectedPlaceholders += 1;
- } else if (isInNightly()) {
+ if (isInNightly()) {
expectedPlaceholders += 2;
}
is(panel.querySelectorAll(".panel-customization-placeholder").length, expectedPlaceholders, "The number of placeholders should be correct.");
CustomizableUI.createWidget({id: kTestWidget2, label: "Pretty label", tooltiptext: "Pretty tooltip", defaultArea: CustomizableUI.AREA_PANEL});
let elem = document.getElementById(kTestWidget2);
let wrapper = document.getElementById("wrapper-" + kTestWidget2);
ok(elem, "There should be an item");
ok(wrapper, "There should be a wrapper");
--- a/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
+++ b/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
@@ -361,24 +361,24 @@ add_task(async function editControlsToPa
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls",
"developer-button",
"sync-button",
];
removeNonReleaseButtons(placementsAfterMove);
- if (isInNightly()) {
+ if (isNotReleaseOrBeta()) {
CustomizableUI.removeWidgetFromArea("webcompat-reporter-button");
}
simulateItemDrag(editControls, panel);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
let zoomControls = document.getElementById("zoom-controls");
simulateItemDrag(editControls, zoomControls);
- if (isInNightly()) {
+ if (isNotReleaseOrBeta()) {
CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_PANEL);
}
ok(CustomizableUI.inDefaultState, "Should still be in default state.");
});
// Dragging the edit-controls to the customization-palette and
// back should work.
add_task(async function() {
--- a/browser/components/customizableui/test/browser_overflow_use_subviews.js
+++ b/browser/components/customizableui/test/browser_overflow_use_subviews.js
@@ -14,16 +14,20 @@ registerCleanupFunction(function*() {
* re-anchored panels. If we ever remove the character encoding widget, please
* replace this test with another subview - don't remove it.
*/
add_task(async function check_character_encoding_subview_in_overflow() {
kOverflowPanel.setAttribute("animate", "false");
gOriginalWidth = window.outerWidth;
CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR);
+ if (isNotReleaseOrBeta()) {
+ CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_NAVBAR);
+ }
+
let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
window.resizeTo(400, window.outerHeight);
await waitForCondition(() => navbar.hasAttribute("overflowing"));
let chevron = document.getElementById("nav-bar-overflow-button");
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -114,39 +114,39 @@ function resetCustomization() {
return CustomizableUI.reset();
}
function isInDevEdition() {
return AppConstants.MOZ_DEV_EDITION;
}
function isInNightly() {
- return AppConstants.NIGHTLY_BUILD;
+ return AppConstants.NIGHTLY_BUILD && !AppConstants.MOZ_DEV_EDITION;
+}
+
+function isNotReleaseOrBeta() {
+ return !AppConstants.RELEASE_OR_BETA;
}
function removeNonReleaseButtons(areaPanelPlacements) {
if (isInDevEdition() && areaPanelPlacements.includes("developer-button")) {
areaPanelPlacements.splice(areaPanelPlacements.indexOf("developer-button"), 1);
}
-
- if (!isInNightly() && areaPanelPlacements.includes("webcompat-reporter-button")) {
- areaPanelPlacements.splice(areaPanelPlacements.indexOf("webcompat-reporter-button"), 1);
- }
}
function removeNonOriginalButtons() {
CustomizableUI.removeWidgetFromArea("sync-button");
- if (isInNightly()) {
+ if (isNotReleaseOrBeta()) {
CustomizableUI.removeWidgetFromArea("webcompat-reporter-button");
}
}
function restoreNonOriginalButtons() {
CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
- if (isInNightly()) {
+ if (isNotReleaseOrBeta()) {
CustomizableUI.addWidgetToArea("webcompat-reporter-button", CustomizableUI.AREA_PANEL);
}
}
function assertAreaPlacements(areaId, expectedPlacements) {
let actualPlacements = getAreaWidgetIds(areaId);
placementArraysEqual(areaId, actualPlacements, expectedPlacements);
}