mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
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:
parent
9e9a234f7e
commit
4ebccc5d10
@ -576,6 +576,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
||||
}
|
||||
});
|
||||
|
||||
this.droppable(false);
|
||||
this._createUndoButton();
|
||||
} else
|
||||
this.close();
|
||||
@ -632,6 +633,7 @@ GroupItem.prototype = Utils.extend(new Item(), new Subscribable(), {
|
||||
this.hidden = false;
|
||||
this.$undoContainer.remove();
|
||||
this.$undoContainer = null;
|
||||
this.droppable(true);
|
||||
|
||||
iQ(this.container).show().animate({
|
||||
"-moz-transform": "scale(1)",
|
||||
|
@ -92,6 +92,7 @@ _BROWSER_FILES = \
|
||||
browser_tabview_bug624727.js \
|
||||
browser_tabview_bug624953.js \
|
||||
browser_tabview_bug625269.js \
|
||||
browser_tabview_bug625424.js \
|
||||
browser_tabview_bug626368.js \
|
||||
browser_tabview_bug627288.js \
|
||||
browser_tabview_bug627736.js \
|
||||
|
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user