michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: let tabOne; michael@0: let tabTwo; michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: tabOne = gBrowser.addTab("http://mochi.test:8888/"); michael@0: tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"); michael@0: michael@0: afterAllTabsLoaded(function () { michael@0: // make sure the tab one is selected because undoCloseTab() would remove michael@0: // the selected tab if it's a blank tab. michael@0: gBrowser.selectedTab = tabOne; michael@0: showTabView(onTabViewWindowLoaded); michael@0: }); michael@0: } michael@0: michael@0: function onTabViewWindowLoaded() { michael@0: let contentWindow = TabView.getContentWindow(); michael@0: let groupItems = contentWindow.GroupItems.groupItems; michael@0: is(groupItems.length, 1, "There is only one group"); michael@0: is(groupItems[0].getChildren().length, 3, "The group has three tab items"); michael@0: michael@0: gBrowser.removeTab(tabTwo); michael@0: ok(TabView.isVisible(), "Tab View is still visible after removing a tab"); michael@0: is(groupItems[0].getChildren().length, 2, "The group has two tab items"); michael@0: michael@0: restoreTab(function (tabTwo) { michael@0: ok(TabView.isVisible(), "Tab View is still visible after restoring a tab"); michael@0: is(groupItems[0].getChildren().length, 3, "The group still has three tab items"); michael@0: michael@0: // clean up and finish michael@0: hideTabView(function () { michael@0: gBrowser.removeTab(tabOne); michael@0: gBrowser.removeTab(tabTwo); michael@0: finish(); michael@0: }); michael@0: }); michael@0: }