browser/components/tabview/test/browser_tabview_bug733115.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:f5f5b69d5ad2
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3
4 function test() {
5 waitForExplicitFinish();
6
7 showTabView(function() {
8 registerCleanupFunction(function() {
9 if (gBrowser.tabs[1])
10 gBrowser.removeTab(gBrowser.tabs[1]);
11 TabView.hide();
12 });
13
14 let contentWindow = TabView.getContentWindow();
15 let groupItem = createEmptyGroupItem(contentWindow, 200, 200, 20);
16 contentWindow.GroupItems.setActiveGroupItem(groupItem);
17
18 // A new tab should be added to the active group and tabview should zoom into it.
19 is(groupItem.getChildren().length, 0, "This group doesn't have any tabitems");
20 whenTabViewIsHidden(function() {
21 is(groupItem.getChildren().length, 1, "This group has one tabitem");
22
23 showTabView(function() {
24 // Ensure that no new tab is added to this non-empty tab group.
25 whenTabViewIsHidden(function() {
26 let tabItems = groupItem.getChildren();
27 is(tabItems.length, 1, "This group has one tabitem");
28 is(tabItems[0].tab, gBrowser.selectedTab, "The same tab");
29
30 tabItems[0].close();
31 groupItem.close();
32
33 finish();
34 });
35 EventUtils.synthesizeKey("VK_RETURN", {}, contentWindow);
36 });
37 });
38 EventUtils.synthesizeKey("VK_RETURN", {}, contentWindow);
39 });
40 }
41

mercurial