|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 // Tests that groups behave properly when closing all tabs but app tabs. |
|
5 |
|
6 function test() { |
|
7 let cw, win, groupItem; |
|
8 |
|
9 let onLoad = function (tvwin) { |
|
10 win = tvwin; |
|
11 registerCleanupFunction(function () win.close()); |
|
12 win.gBrowser.pinTab(win.gBrowser.tabs[0]); |
|
13 win.gBrowser.loadOneTab("about:blank", {inBackground: true}); |
|
14 }; |
|
15 |
|
16 let onShow = function () { |
|
17 cw = win.TabView.getContentWindow(); |
|
18 is(cw.GroupItems.groupItems.length, 1, "There's only one group"); |
|
19 |
|
20 groupItem = createEmptyGroupItem(cw, 200, 200, 20); |
|
21 cw.UI.setActive(groupItem); |
|
22 |
|
23 whenTabViewIsHidden(onHide, win); |
|
24 cw.UI.goToTab(win.gBrowser.tabs[0]); |
|
25 }; |
|
26 |
|
27 let onHide = function () { |
|
28 let tab = win.gBrowser.loadOneTab("about:blank", {inBackground: true}); |
|
29 is(groupItem.getChildren().length, 1, "One tab is in the new group"); |
|
30 |
|
31 executeSoon(function () { |
|
32 is(win.gBrowser.visibleTabs.length, 2, "There are two tabs displayed"); |
|
33 win.gBrowser.removeTab(tab); |
|
34 |
|
35 is(groupItem.getChildren().length, 0, "No tabs are in the new group"); |
|
36 is(win.gBrowser.visibleTabs.length, 1, "There is one tab displayed"); |
|
37 is(cw.GroupItems.groupItems.length, 2, "There are two groups still"); |
|
38 |
|
39 finish(); |
|
40 }); |
|
41 }; |
|
42 |
|
43 waitForExplicitFinish(); |
|
44 |
|
45 newWindowWithTabView(onShow, onLoad); |
|
46 } |