|
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 newWindowWithTabView(function(win) { |
|
8 let cw = win.TabView.getContentWindow(); |
|
9 let groupItem = cw.GroupItems.groupItems[0]; |
|
10 |
|
11 // set the group to 180 x 100 so it shows two tab items without going into |
|
12 // the stacked mode |
|
13 groupItem.setBounds(new cw.Rect(100, 0, 180, 100)); |
|
14 |
|
15 hideTabView(function() { |
|
16 groupItem.addSubscriber("childAdded", function onChildAdded(data) { |
|
17 groupItem.removeSubscriber("childAdded", onChildAdded); |
|
18 |
|
19 is(groupItem.getChildren().length, 3, "The number of children in group is 3"); |
|
20 ok(groupItem.isStacked(), "The group item is stacked after adding a new tab"); |
|
21 |
|
22 let tabItem = groupItem.getChild(2); |
|
23 groupItem.addSubscriber("childRemoved", function onChildRemoved() { |
|
24 tabItem.removeSubscriber("childRemoved", onChildRemoved); |
|
25 |
|
26 is(groupItem.getChildren().length, 2, "The number of children in group is 2"); |
|
27 // give a delay for the active item to be set |
|
28 executeSoon(function() { |
|
29 showTabView(function() { |
|
30 ok(!groupItem.isStacked(), "The group item is not stacked after removing a tab"); |
|
31 finish(); |
|
32 }, win); |
|
33 }); |
|
34 }); |
|
35 win.BrowserCloseTabOrWindow(); |
|
36 }); |
|
37 win.gBrowser.loadOneTab("", {inBackground: true}); |
|
38 }, win); |
|
39 }, function(win) { |
|
40 registerCleanupFunction(function () { |
|
41 win.close(); |
|
42 }); |
|
43 |
|
44 win.gBrowser.addTab(); |
|
45 }); |
|
46 } |