michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: // Tests that groups behave properly when closing all tabs but app tabs. michael@0: michael@0: function test() { michael@0: let cw, win, groupItem; michael@0: michael@0: let onLoad = function (tvwin) { michael@0: win = tvwin; michael@0: registerCleanupFunction(function () win.close()); michael@0: win.gBrowser.pinTab(win.gBrowser.tabs[0]); michael@0: win.gBrowser.loadOneTab("about:blank", {inBackground: true}); michael@0: }; michael@0: michael@0: let onShow = function () { michael@0: cw = win.TabView.getContentWindow(); michael@0: is(cw.GroupItems.groupItems.length, 1, "There's only one group"); michael@0: michael@0: groupItem = createEmptyGroupItem(cw, 200, 200, 20); michael@0: cw.UI.setActive(groupItem); michael@0: michael@0: whenTabViewIsHidden(onHide, win); michael@0: cw.UI.goToTab(win.gBrowser.tabs[0]); michael@0: }; michael@0: michael@0: let onHide = function () { michael@0: let tab = win.gBrowser.loadOneTab("about:blank", {inBackground: true}); michael@0: is(groupItem.getChildren().length, 1, "One tab is in the new group"); michael@0: michael@0: executeSoon(function () { michael@0: is(win.gBrowser.visibleTabs.length, 2, "There are two tabs displayed"); michael@0: win.gBrowser.removeTab(tab); michael@0: michael@0: is(groupItem.getChildren().length, 0, "No tabs are in the new group"); michael@0: is(win.gBrowser.visibleTabs.length, 1, "There is one tab displayed"); michael@0: is(cw.GroupItems.groupItems.length, 2, "There are two groups still"); michael@0: michael@0: finish(); michael@0: }); michael@0: }; michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(onShow, onLoad); michael@0: }