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