Bug 941002 - [Australis] Add Developer Tools button to menu default set. r=Unfocused

This commit is contained in:
Jared Wein 2013-12-17 21:11:59 -05:00
parent ab5018f164
commit 49eac44e91
5 changed files with 89 additions and 73 deletions

View File

@ -150,7 +150,8 @@ let CustomizableUIInternal = {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"
"add-ons-button",
"developer-button",
];
if (gPalette.has("switch-to-metro-button")) {

View File

@ -27,7 +27,7 @@ add_task(function testWrapUnwrap() {
// Creating and destroying a widget should correctly deal with panel placeholders
add_task(function testPanelPlaceholders() {
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 2 : 3, "The number of placeholders should be correct.");
is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 1 : 2, "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);
@ -35,7 +35,7 @@ add_task(function testPanelPlaceholders() {
ok(wrapper, "There should be a wrapper");
is(wrapper.firstChild.id, kTestWidget2, "Wrapper should have test widget");
is(wrapper.parentNode, panel, "Wrapper should be in panel");
is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 1 : 2, "The number of placeholders should be correct.");
is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 3 : 1, "The number of placeholders should be correct.");
CustomizableUI.destroyWidget(kTestWidget2);
wrapper = document.getElementById("wrapper-" + kTestWidget2);
ok(!wrapper, "There should be a wrapper");

View File

@ -9,13 +9,13 @@ Services.prefs.setBoolPref("browser.uiCustomization.skipSourceNodeCheck", true);
// Dragging an item from the palette to another button in the panel should work.
add_task(function() {
yield startCustomizing();
let btn = document.getElementById("developer-button");
let btn = document.getElementById("feed-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
let lastButtonIndex = placements.length - 1;
let lastButton = placements[lastButtonIndex];
let placementsAfterInsert = placements.slice(0, lastButtonIndex).concat(["developer-button", lastButton]);
let placementsAfterInsert = placements.slice(0, lastButtonIndex).concat(["feed-button", lastButton]);
let lastButtonNode = document.getElementById(lastButton);
simulateItemDrag(btn, lastButtonNode);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
@ -28,11 +28,11 @@ add_task(function() {
// Dragging an item from the palette to the panel itself should also work.
add_task(function() {
yield startCustomizing();
let btn = document.getElementById("developer-button");
let btn = document.getElementById("feed-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
let placementsAfterAppend = placements.concat(["developer-button"]);
let placementsAfterAppend = placements.concat(["feed-button"]);
simulateItemDrag(btn, panel);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
@ -48,12 +48,12 @@ add_task(function() {
CustomizableUI.removeWidgetFromArea(widgetIds.shift());
}
yield startCustomizing();
let btn = document.getElementById("developer-button");
let btn = document.getElementById("feed-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
assertAreaPlacements(panel.id, []);
let placementsAfterAppend = ["developer-button"];
let placementsAfterAppend = ["feed-button"];
simulateItemDrag(btn, panel);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");

View File

@ -22,7 +22,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, printButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -47,7 +48,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, savePageButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -70,7 +72,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, newWindowButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -92,7 +95,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, historyPanelMenu);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -118,7 +122,8 @@ add_task(function() {
"zoom-controls",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, preferencesButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -131,10 +136,10 @@ add_task(function() {
// Dragging an item from the palette to before the zoom-controls should move it and two other buttons before the zoom controls.
add_task(function() {
yield startCustomizing();
let developerButton = document.getElementById("developer-button");
let openFileButton = document.getElementById("open-file-button");
let zoomControls = document.getElementById("zoom-controls");
let placementsAfterInsert = ["edit-controls",
"developer-button",
"open-file-button",
"new-window-button",
"privatebrowsing-button",
"zoom-controls",
@ -144,9 +149,10 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterInsert);
simulateItemDrag(developerButton, zoomControls);
simulateItemDrag(openFileButton, zoomControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
let palette = document.getElementById("customization-palette");
@ -157,9 +163,9 @@ add_task(function() {
"feed-button should be a child of wrapper-feed-button");
is(feedWrapper.getAttribute("place"), "palette",
"The feed-button wrapper should have it's place set to 'palette'");
simulateItemDrag(developerButton, palette);
is(developerButton.parentNode.tagName, "toolbarpaletteitem",
"The developer-button should be wrapped by a toolbarpaletteitem");
simulateItemDrag(openFileButton, palette);
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
"The open-file-button should be wrapped by a toolbarpaletteitem");
let newWindowButton = document.getElementById("new-window-button");
simulateItemDrag(zoomControls, newWindowButton);
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
@ -169,9 +175,9 @@ add_task(function() {
// should move it and two other buttons before the edit and zoom controls.
add_task(function() {
yield startCustomizing();
let developerButton = document.getElementById("developer-button");
let openFileButton = document.getElementById("open-file-button");
let editControls = document.getElementById("edit-controls");
let placementsAfterInsert = ["developer-button",
let placementsAfterInsert = ["open-file-button",
"new-window-button",
"privatebrowsing-button",
"edit-controls",
@ -182,9 +188,10 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterInsert);
simulateItemDrag(developerButton, editControls);
simulateItemDrag(openFileButton, editControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
let palette = document.getElementById("customization-palette");
@ -195,9 +202,9 @@ add_task(function() {
"feed-button should be a child of wrapper-feed-button");
is(feedWrapper.getAttribute("place"), "palette",
"The feed-button wrapper should have it's place set to 'palette'");
simulateItemDrag(developerButton, palette);
is(developerButton.parentNode.tagName, "toolbarpaletteitem",
"The developer-button should be wrapped by a toolbarpaletteitem");
simulateItemDrag(openFileButton, palette);
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
"The open-file-button should be wrapped by a toolbarpaletteitem");
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
});
@ -217,7 +224,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, zoomControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -240,7 +248,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, newWindowButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -266,7 +275,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, privateBrowsingButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -292,7 +302,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, savePageButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -317,7 +328,8 @@ add_task(function() {
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls"];
"edit-controls",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, panel);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -341,7 +353,8 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button"];
"add-ons-button",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
let paletteChildElementCount = palette.childElementCount;
simulateItemDrag(editControls, palette);
@ -365,7 +378,7 @@ add_task(function() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let numPlaceholders = isInWin8() ? 2 : 3;
let numPlaceholders = isInWin8() ? 1 : 2;
for (let i = 0; i < numPlaceholders; i++) {
// NB: We can't just iterate over all of the placeholders
// because each drag-drop action recreates them.
@ -380,7 +393,8 @@ add_task(function() {
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls"];
"edit-controls",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, placeholder);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -390,15 +404,15 @@ add_task(function() {
}
});
// Dragging the developer-button back on to itself should work.
// Dragging the open-file-button back on to itself should work.
add_task(function() {
yield startCustomizing();
let developerButton = document.getElementById("developer-button");
is(developerButton.parentNode.tagName, "toolbarpaletteitem",
"developer-button should be wrapped by a toolbarpaletteitem");
simulateItemDrag(developerButton, developerButton);
is(developerButton.parentNode.tagName, "toolbarpaletteitem",
"developer-button should be wrapped by a toolbarpaletteitem");
let openFileButton = document.getElementById("open-file-button");
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
"open-file-button should be wrapped by a toolbarpaletteitem");
simulateItemDrag(openFileButton, openFileButton);
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
"open-file-button should be wrapped by a toolbarpaletteitem");
let editControls = document.getElementById("edit-controls");
is(editControls.parentNode.tagName, "toolbarpaletteitem",
"edit-controls should be wrapped by a toolbarpaletteitem");
@ -421,17 +435,14 @@ add_task(function() {
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls"];
"edit-controls",
"developer-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, target);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
let itemToDrag = "sync-button";
let button = document.getElementById(itemToDrag);
if (!isInWin8()) {
placementsAfterMove.push(itemToDrag);
} else {
placementsAfterMove.splice(11, 0, itemToDrag);
}
simulateItemDrag(button, editControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);

View File

@ -9,13 +9,13 @@ Services.prefs.setBoolPref("browser.uiCustomization.skipSourceNodeCheck", true);
// One orphaned item should have two placeholders next to it.
add_task(function() {
yield startCustomizing();
let btn = document.getElementById("developer-button");
let btn = document.getElementById("open-file-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
if (!isInWin8()) {
placements = placements.concat(["developer-button"]);
simulateItemDrag(btn, panel);
if (isInWin8()) {
CustomizableUI.removeWidgetFromArea("switch-to-metro-button");
placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
} else {
ok(CustomizableUI.inDefaultState, "Should be in default state.");
@ -28,9 +28,8 @@ add_task(function() {
yield startCustomizing();
is(getVisiblePlaceholderCount(panel), 2, "Should only have 2 visible placeholders after re-entering");
if (!isInWin8()) {
let palette = document.getElementById("customization-palette");
simulateItemDrag(btn, palette);
if (isInWin8()) {
CustomizableUI.addWidgetToArea("switch-to-metro-button", CustomizableUI.AREA_PANEL);
}
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
});
@ -38,32 +37,30 @@ add_task(function() {
// Two orphaned items should have one placeholder next to them (case 1).
add_task(function() {
yield startCustomizing();
let btn = document.getElementById("developer-button");
let btn = document.getElementById("open-file-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
let placementsAfterAppend = placements.concat(["developer-button"]);
simulateItemDrag(btn, panel);
let placementsAfterAppend = placements;
if (!isInWin8()) {
placementsAfterAppend = placementsAfterAppend.concat(["sync-button"]);
btn = document.getElementById("sync-button");
placementsAfterAppend = placements.concat(["open-file-button"]);
simulateItemDrag(btn, panel);
}
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholders before exiting");
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholder before exiting");
yield endCustomizing();
yield startCustomizing();
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholders after re-entering");
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholder after re-entering");
let palette = document.getElementById("customization-palette");
simulateItemDrag(btn, palette);
if (!isInWin8()) {
btn = document.getElementById("developer-button");
btn = document.getElementById("open-file-button");
simulateItemDrag(btn, palette);
}
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
@ -73,31 +70,34 @@ add_task(function() {
add_task(function() {
yield startCustomizing();
let btn = document.getElementById("add-ons-button");
let btn2 = document.getElementById("switch-to-metro-button");
let btn2 = document.getElementById("developer-button");
let btn3 = document.getElementById("switch-to-metro-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let palette = document.getElementById("customization-palette");
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
let placementsAfterAppend = placements.filter(p => p != btn.id);
let placementsAfterAppend = placements.filter(p => p != btn.id && p != btn2.id);
simulateItemDrag(btn, palette);
simulateItemDrag(btn2, palette);
if (isInWin8()) {
placementsAfterAppend = placementsAfterAppend.filter(p => p != btn2.id);
simulateItemDrag(btn2, palette);
placementsAfterAppend = placementsAfterAppend.filter(p => p != btn3.id);
simulateItemDrag(btn3, palette);
}
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholders before exiting");
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholder before exiting");
yield endCustomizing();
yield startCustomizing();
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholders after re-entering");
is(getVisiblePlaceholderCount(panel), 1, "Should only have 1 visible placeholder after re-entering");
simulateItemDrag(btn, panel);
simulateItemDrag(btn2, panel);
if (isInWin8()) {
simulateItemDrag(btn2, panel);
simulateItemDrag(btn3, panel);
}
assertAreaPlacements(CustomizableUI.AREA_PANEL, placements);
@ -108,11 +108,14 @@ add_task(function() {
add_task(function() {
yield startCustomizing();
let btn = document.getElementById("edit-controls");
let developerButton = document.getElementById("developer-button");
let metroBtn = document.getElementById("switch-to-metro-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let palette = document.getElementById("customization-palette");
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
placements.pop();
simulateItemDrag(developerButton, palette);
if (isInWin8()) {
// Remove switch-to-metro-button
placements.pop();
@ -129,6 +132,7 @@ add_task(function() {
yield startCustomizing();
is(getVisiblePlaceholderCount(panel), 3, "Should have 3 visible placeholders after re-entering");
simulateItemDrag(developerButton, panel);
if (isInWin8()) {
simulateItemDrag(metroBtn, panel);
}
@ -137,10 +141,10 @@ add_task(function() {
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
});
// The default placements should have three placeholders at the bottom (or 2 in win8).
// The default placements should have two placeholders at the bottom (or 1 in win8).
add_task(function() {
yield startCustomizing();
let numPlaceholders = isInWin8() ? 2 : 3;
let numPlaceholders = isInWin8() ? 1 : 2;
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
ok(CustomizableUI.inDefaultState, "Should be in default state.");
is(getVisiblePlaceholderCount(panel), numPlaceholders, "Should have " + numPlaceholders + " visible placeholders before exiting");