1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug608037.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +let tabOne; 1.8 +let tabTwo; 1.9 + 1.10 +function test() { 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + tabOne = gBrowser.addTab("http://mochi.test:8888/"); 1.14 + tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html"); 1.15 + 1.16 + afterAllTabsLoaded(function () { 1.17 + // make sure the tab one is selected because undoCloseTab() would remove 1.18 + // the selected tab if it's a blank tab. 1.19 + gBrowser.selectedTab = tabOne; 1.20 + showTabView(onTabViewWindowLoaded); 1.21 + }); 1.22 +} 1.23 + 1.24 +function onTabViewWindowLoaded() { 1.25 + let contentWindow = TabView.getContentWindow(); 1.26 + let groupItems = contentWindow.GroupItems.groupItems; 1.27 + is(groupItems.length, 1, "There is only one group"); 1.28 + is(groupItems[0].getChildren().length, 3, "The group has three tab items"); 1.29 + 1.30 + gBrowser.removeTab(tabTwo); 1.31 + ok(TabView.isVisible(), "Tab View is still visible after removing a tab"); 1.32 + is(groupItems[0].getChildren().length, 2, "The group has two tab items"); 1.33 + 1.34 + restoreTab(function (tabTwo) { 1.35 + ok(TabView.isVisible(), "Tab View is still visible after restoring a tab"); 1.36 + is(groupItems[0].getChildren().length, 3, "The group still has three tab items"); 1.37 + 1.38 + // clean up and finish 1.39 + hideTabView(function () { 1.40 + gBrowser.removeTab(tabOne); 1.41 + gBrowser.removeTab(tabTwo); 1.42 + finish(); 1.43 + }); 1.44 + }); 1.45 +}