Backed out changeset 77e83106be39 (bug 941002)

This commit is contained in:
Jared Wein 2013-12-19 13:29:14 -05:00
Родитель 2a2f19eff9
Коммит cd43cc8082
5 изменённых файлов: 73 добавлений и 95 удалений

Просмотреть файл

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

Просмотреть файл

@ -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() ? 1 : 2, "The number of placeholders should be correct.");
is(panel.querySelectorAll(".panel-customization-placeholder").length, isInWin8() ? 2 : 3, "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() ? 3 : 1, "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.destroyWidget(kTestWidget2);
wrapper = document.getElementById("wrapper-" + kTestWidget2);
ok(!wrapper, "There should be a wrapper");

Просмотреть файл

@ -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("feed-button");
let btn = document.getElementById("developer-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(["feed-button", lastButton]);
let placementsAfterInsert = placements.slice(0, lastButtonIndex).concat(["developer-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("feed-button");
let btn = document.getElementById("developer-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
let placementsAfterAppend = placements.concat(["feed-button"]);
let placementsAfterAppend = placements.concat(["developer-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("feed-button");
let btn = document.getElementById("developer-button");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
assertAreaPlacements(panel.id, []);
let placementsAfterAppend = ["feed-button"];
let placementsAfterAppend = ["developer-button"];
simulateItemDrag(btn, panel);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");

Просмотреть файл

@ -22,8 +22,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, printButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -48,8 +47,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, savePageButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -72,8 +70,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, newWindowButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -95,8 +92,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, historyPanelMenu);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -122,8 +118,7 @@ add_task(function() {
"zoom-controls",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(zoomControls, preferencesButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -136,10 +131,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 openFileButton = document.getElementById("open-file-button");
let developerButton = document.getElementById("developer-button");
let zoomControls = document.getElementById("zoom-controls");
let placementsAfterInsert = ["edit-controls",
"open-file-button",
"developer-button",
"new-window-button",
"privatebrowsing-button",
"zoom-controls",
@ -149,10 +144,9 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterInsert);
simulateItemDrag(openFileButton, zoomControls);
simulateItemDrag(developerButton, zoomControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
let palette = document.getElementById("customization-palette");
@ -163,9 +157,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(openFileButton, palette);
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
"The open-file-button should be wrapped by a toolbarpaletteitem");
simulateItemDrag(developerButton, palette);
is(developerButton.parentNode.tagName, "toolbarpaletteitem",
"The developer-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.");
@ -175,9 +169,9 @@ add_task(function() {
// should move it and two other buttons before the edit and zoom controls.
add_task(function() {
yield startCustomizing();
let openFileButton = document.getElementById("open-file-button");
let developerButton = document.getElementById("developer-button");
let editControls = document.getElementById("edit-controls");
let placementsAfterInsert = ["open-file-button",
let placementsAfterInsert = ["developer-button",
"new-window-button",
"privatebrowsing-button",
"edit-controls",
@ -188,10 +182,9 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterInsert);
simulateItemDrag(openFileButton, editControls);
simulateItemDrag(developerButton, editControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
let palette = document.getElementById("customization-palette");
@ -202,9 +195,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(openFileButton, palette);
is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
"The open-file-button should be wrapped by a toolbarpaletteitem");
simulateItemDrag(developerButton, palette);
is(developerButton.parentNode.tagName, "toolbarpaletteitem",
"The developer-button should be wrapped by a toolbarpaletteitem");
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
});
@ -224,8 +217,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, zoomControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -248,8 +240,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, newWindowButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -275,8 +266,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, privateBrowsingButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -302,8 +292,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, savePageButton);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -328,8 +317,7 @@ add_task(function() {
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls",
"developer-button"];
"edit-controls"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, panel);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -353,8 +341,7 @@ add_task(function() {
"fullscreen-button",
"find-button",
"preferences-button",
"add-ons-button",
"developer-button"];
"add-ons-button"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
let paletteChildElementCount = palette.childElementCount;
simulateItemDrag(editControls, palette);
@ -378,7 +365,7 @@ add_task(function() {
yield startCustomizing();
let editControls = document.getElementById("edit-controls");
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
let numPlaceholders = isInWin8() ? 1 : 2;
let numPlaceholders = isInWin8() ? 2 : 3;
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.
@ -393,8 +380,7 @@ add_task(function() {
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls",
"developer-button"];
"edit-controls"];
addSwitchToMetroButtonInWindows8(placementsAfterMove);
simulateItemDrag(editControls, placeholder);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
@ -404,15 +390,15 @@ add_task(function() {
}
});
// Dragging the open-file-button back on to itself should work.
// Dragging the developer-button back on to itself should work.
add_task(function() {
yield startCustomizing();
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 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 editControls = document.getElementById("edit-controls");
is(editControls.parentNode.tagName, "toolbarpaletteitem",
"edit-controls should be wrapped by a toolbarpaletteitem");
@ -435,19 +421,16 @@ add_task(function() {
"find-button",
"preferences-button",
"add-ons-button",
"edit-controls",
"developer-button"];
"edit-controls"];
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);
if (isInWin8()) {
placementsAfterMove[10] = placementsAfterMove[11];
placementsAfterMove[11] = placementsAfterMove[12];
placementsAfterMove[12] = placementsAfterMove[13];
placementsAfterMove[13] = "edit-controls";
}
simulateItemDrag(button, editControls);
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);

Просмотреть файл

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