mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Back out e878799f7d5a for browser-chrome bustage.
This commit is contained in:
parent
919bb15f9d
commit
43985a3c6f
@ -777,9 +777,6 @@ CustomizeMode.prototype = {
|
||||
},
|
||||
|
||||
_setDragActive: function(aItem, aValue, aWidth, aAtEnd) {
|
||||
if (!aItem) {
|
||||
return;
|
||||
}
|
||||
let node = aItem;
|
||||
let window = aItem.ownerDocument.defaultView;
|
||||
let direction = window.getComputedStyle(aItem, null).direction;
|
||||
|
@ -13,7 +13,6 @@ include $(DEPTH)/config/autoconf.mk
|
||||
MOCHITEST_BROWSER_FILES = \
|
||||
browser_873501_handle_specials.js \
|
||||
browser_877178_unregisterArea.js \
|
||||
browser_878452_drag_to_panel.js \
|
||||
head.js \
|
||||
$(NULL)
|
||||
|
||||
|
@ -1,81 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
let gTests = [
|
||||
{
|
||||
desc: "Dragging an item from the palette to another button in the panel should work.",
|
||||
setup: startCustomizing,
|
||||
run: function() {
|
||||
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(["developer-button", lastButton]);
|
||||
let lastButtonNode = document.getElementById(lastButton);
|
||||
simulateItemDrag(btn, lastButtonNode);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
let palette = document.getElementById("customization-palette");
|
||||
simulateItemDrag(btn, palette);
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
},
|
||||
teardown: endCustomizing
|
||||
},
|
||||
{
|
||||
desc: "Dragging an item from the palette to the panel itself should also work.",
|
||||
setup: startCustomizing,
|
||||
run: function() {
|
||||
let btn = document.getElementById("developer-button");
|
||||
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
|
||||
let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
|
||||
|
||||
let placementsAfterAppend = placements.concat(["developer-button"]);
|
||||
simulateItemDrag(btn, panel);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
let palette = document.getElementById("customization-palette");
|
||||
simulateItemDrag(btn, palette);
|
||||
ok(CustomizableUI.inDefaultState, "Should be in default state again.");
|
||||
},
|
||||
teardown: endCustomizing
|
||||
},
|
||||
{
|
||||
desc: "Dragging an item from the palette to an empty panel should also work.",
|
||||
setup: function() {
|
||||
let widgetIds = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
|
||||
while (widgetIds.length) {
|
||||
CustomizableUI.removeWidgetFromArea(widgetIds.shift());
|
||||
}
|
||||
return startCustomizing()
|
||||
},
|
||||
run: function() {
|
||||
let btn = document.getElementById("developer-button");
|
||||
let panel = document.getElementById(CustomizableUI.AREA_PANEL);
|
||||
|
||||
assertAreaPlacements(panel.id, []);
|
||||
|
||||
let placementsAfterAppend = ["developer-button"];
|
||||
simulateItemDrag(btn, panel);
|
||||
assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
|
||||
ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
|
||||
let palette = document.getElementById("customization-palette");
|
||||
simulateItemDrag(btn, palette);
|
||||
assertAreaPlacements(panel.id, []);
|
||||
},
|
||||
teardown: endCustomizing
|
||||
}
|
||||
];
|
||||
|
||||
function cleanup() {
|
||||
resetCustomization();
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(cleanup);
|
||||
runTests(gTests);
|
||||
}
|
||||
|
@ -5,16 +5,9 @@
|
||||
|
||||
// Avoid leaks by using tmp for imports...
|
||||
let tmp = {};
|
||||
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js", tmp);
|
||||
Cu.import("resource://gre/modules/Task.jsm", tmp);
|
||||
Cu.import("resource:///modules/CustomizableUI.jsm", tmp);
|
||||
let {Promise, Task, CustomizableUI} = tmp;
|
||||
|
||||
let ChromeUtils = {};
|
||||
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci.mozIJSSubScriptLoader);
|
||||
scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js", ChromeUtils);
|
||||
|
||||
let {synthesizeDragStart, synthesizeDrop} = ChromeUtils;
|
||||
let {Task, CustomizableUI} = tmp;
|
||||
|
||||
const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
|
||||
|
||||
@ -48,15 +41,12 @@ function removeCustomToolbars() {
|
||||
|
||||
function resetCustomization() {
|
||||
CustomizableUI.reset();
|
||||
if (document.documentElement.hasAttribute("customizing")) {
|
||||
window.gCustomizeMode.exit();
|
||||
}
|
||||
}
|
||||
|
||||
function assertAreaPlacements(areaId, expectedPlacements) {
|
||||
let actualPlacements = getAreaWidgetIds(areaId);
|
||||
is(actualPlacements.length, expectedPlacements.length,
|
||||
"Area " + areaId + " should have " + expectedPlacements.length + " items.");
|
||||
"Area " + areaId + " should have the right number of items.");
|
||||
let minItems = Math.min(expectedPlacements.length, actualPlacements.length);
|
||||
for (let i = 0; i < minItems; i++) {
|
||||
if (typeof expectedPlacements[i] == "string") {
|
||||
@ -78,35 +68,6 @@ function getAreaWidgetIds(areaId) {
|
||||
return widgetAry.map(x => x.id);
|
||||
}
|
||||
|
||||
function simulateItemDrag(toDrag, target) {
|
||||
let docId = toDrag.ownerDocument.documentElement.id;
|
||||
let dragData = [[{type: 'text/toolbarwrapper-id/' + docId,
|
||||
data: {id: toDrag.id, width: toDrag.getBoundingClientRect().width + 'px'}}]];
|
||||
synthesizeDragStart(toDrag.parentNode, dragData);
|
||||
synthesizeDrop(target, target, dragData);
|
||||
}
|
||||
|
||||
function endCustomizing() {
|
||||
let deferred = Promise.defer();
|
||||
function onCustomizationEnds(ev) {
|
||||
window.gNavToolbox.removeEventListener("aftercustomization", onCustomizationEnds);
|
||||
deferred.resolve(ev);
|
||||
}
|
||||
window.gNavToolbox.addEventListener("aftercustomization", onCustomizationEnds);
|
||||
window.gCustomizeMode.exit();
|
||||
return deferred.promise;
|
||||
}
|
||||
function startCustomizing() {
|
||||
let deferred = Promise.defer();
|
||||
function onCustomizing() {
|
||||
window.gNavToolbox.removeEventListener("customizationready", onCustomizing);
|
||||
deferred.resolve();
|
||||
}
|
||||
window.gNavToolbox.addEventListener("customizationready", onCustomizing);
|
||||
window.gCustomizeMode.enter();
|
||||
return deferred.promise;
|
||||
}
|
||||
|
||||
function testRunner(testAry) {
|
||||
for (let test of testAry) {
|
||||
info(test.desc);
|
||||
|
Loading…
Reference in New Issue
Block a user