|
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 // create two groups and each group has one tab item |
|
8 let newState = { |
|
9 windows: [{ |
|
10 tabs: [{ |
|
11 entries: [{ url: "about:robots" }], |
|
12 hidden: true, |
|
13 attributes: {}, |
|
14 extData: { |
|
15 "tabview-tab": |
|
16 '{"bounds":{"left":21,"top":29,"width":204,"height":153},' + |
|
17 '"userSize":null,"url":"about:robots","groupID":1,' + |
|
18 '"imageData":null,"title":null}' |
|
19 } |
|
20 },{ |
|
21 entries: [{ url: "about:robots" }], |
|
22 hidden: false, |
|
23 attributes: {}, |
|
24 extData: { |
|
25 "tabview-tab": |
|
26 '{"bounds":{"left":315,"top":29,"width":111,"height":84},' + |
|
27 '"userSize":null,"url":"about:robots","groupID":2,' + |
|
28 '"imageData":null,"title":null}' |
|
29 }, |
|
30 }], |
|
31 selected:2, |
|
32 _closedTabs: [], |
|
33 extData: { |
|
34 "tabview-groups": '{"nextID":3,"activeGroupId":2}', |
|
35 "tabview-group": |
|
36 '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},' + |
|
37 '"userSize":null,"title":"","id":1},' + |
|
38 '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},' + |
|
39 '"userSize":null,"title":"","id":2}}', |
|
40 "tabview-ui": '{"pageBounds":{"left":0,"top":0,"width":788,"height":548}}' |
|
41 }, sizemode:"normal" |
|
42 }] |
|
43 }; |
|
44 |
|
45 newWindowWithState(newState, function(win) { |
|
46 registerCleanupFunction(function () win.close()); |
|
47 |
|
48 whenTabViewIsShown(function() { |
|
49 let cw = win.TabView.getContentWindow(); |
|
50 |
|
51 is(cw.GroupItems.groupItems.length, 2, "There are still two groups"); |
|
52 is(win.gBrowser.tabs.length, 1, "There is only one tab"); |
|
53 is(cw.UI.getActiveTab(), win.gBrowser.selectedTab._tabViewTabItem, "The last tab is selected"); |
|
54 |
|
55 finish(); |
|
56 }, win); |
|
57 win.gBrowser.removeTab(win.gBrowser.selectedTab); |
|
58 }); |
|
59 } |
|
60 |