Bug 625424 - Dropping a tab onto the 'undo close group' dialog adds the tab to that group [r=ian, a=beltzner]

--HG--
extra : rebase_source : 98ec1d7d6cb2af575ca227b36837bfef430f1b4c
This commit is contained in:
Tim Taubert 2011-01-30 03:29:00 +01:00
parent 3c0d568958
commit b6eee711a5
3 changed files with 92 additions and 0 deletions

View File

@ -576,6 +576,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
} }
}); });
this.droppable(false);
this._createUndoButton(); this._createUndoButton();
} else } else
this.close(); this.close();
@ -632,6 +633,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
this.hidden = false; this.hidden = false;
this.$undoContainer.remove(); this.$undoContainer.remove();
this.$undoContainer = null; this.$undoContainer = null;
this.droppable(true);
iQ(this.container).show().animate({ iQ(this.container).show().animate({
"-moz-transform": "scale(1)", "-moz-transform": "scale(1)",

View File

@ -92,6 +92,7 @@ _BROWSER_FILES = \
browser_tabview_bug624727.js \ browser_tabview_bug624727.js \
browser_tabview_bug624953.js \ browser_tabview_bug624953.js \
browser_tabview_bug625269.js \ browser_tabview_bug625269.js \
browser_tabview_bug625424.js \
browser_tabview_bug626368.js \ browser_tabview_bug626368.js \
browser_tabview_bug627288.js \ browser_tabview_bug627288.js \
browser_tabview_bug627736.js \ browser_tabview_bug627736.js \

View File

@ -0,0 +1,89 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
let win;
let cw;
let getGroupItem = function (index) {
return cw.GroupItems.groupItems[index];
}
let createOrphan = function (callback) {
let tab = win.gBrowser.loadOneTab('about:blank', {inBackground: true});
afterAllTabsLoaded(function () {
let tabItem = tab._tabViewTabItem;
tabItem.parent.remove(tabItem);
callback(tabItem);
});
}
let hideGroupItem = function (groupItem, callback) {
groupItem.addSubscriber(groupItem, 'groupHidden', function () {
groupItem.removeSubscriber(groupItem, 'groupHidden');
callback();
});
groupItem.closeAll();
}
let newWindow = function (test) {
newWindowWithTabView(function (tvwin) {
registerCleanupFunction(function () {
if (!tvwin.closed)
tvwin.close();
});
win = tvwin;
cw = win.TabView.getContentWindow();
test();
});
}
let assertNumberOfTabsInGroupItem = function (groupItem, numTabs) {
is(groupItem.getChildren().length, numTabs,
'there are ' + numTabs + ' tabs in this groupItem');
}
let testDragOnHiddenGroup = function () {
createOrphan(function (orphan) {
let groupItem = getGroupItem(0);
hideGroupItem(groupItem, function () {
let drag = orphan.container;
let drop = groupItem.$undoContainer[0];
assertNumberOfTabsInGroupItem(groupItem, 1);
EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw);
EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw);
EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw);
assertNumberOfTabsInGroupItem(groupItem, 1);
win.close();
newWindow(testDragOnVisibleGroup);
});
});
}
let testDragOnVisibleGroup = function () {
createOrphan(function (orphan) {
let groupItem = getGroupItem(0);
let drag = orphan.container;
let drop = groupItem.container;
assertNumberOfTabsInGroupItem(groupItem, 1);
EventUtils.synthesizeMouseAtCenter(drag, {type: 'mousedown'}, cw);
EventUtils.synthesizeMouseAtCenter(drop, {type: 'mousemove'}, cw);
EventUtils.synthesizeMouseAtCenter(drop, {type: 'mouseup'}, cw);
assertNumberOfTabsInGroupItem(groupItem, 2);
win.close();
finish();
});
}
waitForExplicitFinish();
newWindow(testDragOnHiddenGroup);
}