Bug 685692 - "Move to Group" should always insert the moved tab into the same place r=dietrich

This commit is contained in:
Raymond Lee 2011-09-20 18:00:02 +08:00
parent 8414ad55ed
commit 574fe51799
3 changed files with 56 additions and 1 deletions

View File

@ -2604,7 +2604,7 @@ let GroupItems = {
if (groupItemId) {
groupItem = GroupItems.groupItem(groupItemId);
groupItem.add(tab._tabViewTabItem);
UI.setReorderTabItemsOnShow(groupItem);
groupItem.reorderTabsBasedOnTabItemOrder()
} else {
let pageBounds = Items.getPageBounds();
pageBounds.inset(20, 20);

View File

@ -158,6 +158,7 @@ _BROWSER_FILES = \
browser_tabview_bug677310.js \
browser_tabview_bug679853.js \
browser_tabview_bug681599.js \
browser_tabview_bug685692.js \
browser_tabview_bug686654.js \
browser_tabview_click_group.js \
browser_tabview_dragdrop.js \

View File

@ -0,0 +1,54 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
waitForExplicitFinish();
gBrowser.addTab("http://example.com/");
gBrowser.addTab("http://example.com/");
registerCleanupFunction(function () {
while (gBrowser.tabs.length > 1)
gBrowser.removeTab(gBrowser.tabs[1]);
hideTabView();
})
afterAllTabsLoaded(function() {
showTabView(function() {
let cw = TabView.getContentWindow();
let groupItemOne = cw.GroupItems.groupItems[0];
is(groupItemOne.getChildren().length, 3, "The number of tabs in group one is 3");
// create a group with a blank tab
let groupItemTwo = createGroupItemWithBlankTabs(window, 400, 400, 40, 1);
is(groupItemTwo.getChildren().length, 1, "The number of tabs in group two is 1");
cw.UI.setActive(groupItemOne);
moveTabToAnotherGroup(groupItemOne.getChild(2).tab, groupItemOne, groupItemTwo, function() {
moveTabToAnotherGroup(groupItemOne.getChild(1).tab, groupItemOne, groupItemTwo, function() {
cw.UI.setActive(groupItemOne);
hideTabView(finish);
});
});
});
});
}
function moveTabToAnotherGroup(targetTab, groupItemOne, groupItemTwo, callback) {
hideTabView(function() {
let tabCountInGroupItemOne = groupItemOne.getChildren().length;
let tabCountInGroupItemTwo = groupItemTwo.getChildren().length;
TabView.moveTabTo(targetTab, groupItemTwo.id);
showTabView(function() {
is(groupItemOne.getChildren().length, --tabCountInGroupItemOne, "The number of tab items in group one is decreased");
is(groupItemTwo.getChildren().length, ++tabCountInGroupItemTwo, "The number of tab items in group two is increased");
is(groupItemTwo.getChild(tabCountInGroupItemTwo-1).tab, targetTab, "The last tab is the moved tab");
callback();
});
});
}