browser/components/tabview/test/browser_tabview_bug608037.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:4e8e38e6d6aa
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 let tabOne;
5 let tabTwo;
6
7 function test() {
8 waitForExplicitFinish();
9
10 tabOne = gBrowser.addTab("http://mochi.test:8888/");
11 tabTwo = gBrowser.addTab("http://mochi.test:8888/browser/browser/components/tabview/test/dummy_page.html");
12
13 afterAllTabsLoaded(function () {
14 // make sure the tab one is selected because undoCloseTab() would remove
15 // the selected tab if it's a blank tab.
16 gBrowser.selectedTab = tabOne;
17 showTabView(onTabViewWindowLoaded);
18 });
19 }
20
21 function onTabViewWindowLoaded() {
22 let contentWindow = TabView.getContentWindow();
23 let groupItems = contentWindow.GroupItems.groupItems;
24 is(groupItems.length, 1, "There is only one group");
25 is(groupItems[0].getChildren().length, 3, "The group has three tab items");
26
27 gBrowser.removeTab(tabTwo);
28 ok(TabView.isVisible(), "Tab View is still visible after removing a tab");
29 is(groupItems[0].getChildren().length, 2, "The group has two tab items");
30
31 restoreTab(function (tabTwo) {
32 ok(TabView.isVisible(), "Tab View is still visible after restoring a tab");
33 is(groupItems[0].getChildren().length, 3, "The group still has three tab items");
34
35 // clean up and finish
36 hideTabView(function () {
37 gBrowser.removeTab(tabOne);
38 gBrowser.removeTab(tabTwo);
39 finish();
40 });
41 });
42 }

mercurial