|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 let state = { |
|
5 windows: [{ |
|
6 tabs: [{ |
|
7 entries: [{ url: "about:robots" }], |
|
8 hidden: true, |
|
9 extData: {"tabview-tab": '{"url":"about:robots","groupID":1,"bounds":{"left":120,"top":20,"width":20,"height":20}}'} |
|
10 },{ |
|
11 entries: [{ url: "about:robots" }], |
|
12 hidden: false, |
|
13 extData: {"tabview-tab": '{"url":"about:robots","groupID":2,"bounds":{"left":20,"top":20,"width":20,"height":20}}'}, |
|
14 }], |
|
15 selected: 2, |
|
16 extData: { |
|
17 "tabview-groups": '{"nextID":3,"activeGroupId":2, "totalNumber":2}', |
|
18 "tabview-group": |
|
19 '{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' + |
|
20 '"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}' |
|
21 } |
|
22 }] |
|
23 }; |
|
24 |
|
25 function test() { |
|
26 waitForExplicitFinish(); |
|
27 |
|
28 newWindowWithState(state, function(win) { |
|
29 registerCleanupFunction(function() win.close()); |
|
30 |
|
31 win.gBrowser.addTab(); |
|
32 |
|
33 ok(win.gBrowser.tabs[0].hidden, "The first tab is hidden"); |
|
34 win.gBrowser.selectedTab = win.gBrowser.tabs[0]; |
|
35 |
|
36 function onTabViewFrameInitialized() { |
|
37 win.removeEventListener( |
|
38 "tabviewframeinitialized", onTabViewFrameInitialized, false); |
|
39 |
|
40 let cw = win.TabView.getContentWindow(); |
|
41 is(cw.GroupItems.groupItem(1).getChild(0).tab, win.gBrowser.selectedTab, "The tab in group one matches the selected tab"); |
|
42 is(cw.GroupItems.groupItem(1).getChildren().length, 1, "The group one has only one tab item"); |
|
43 is(cw.GroupItems.groupItem(2).getChildren().length, 2, "The group one has only two tab item") |
|
44 |
|
45 finish(); |
|
46 } |
|
47 win.addEventListener( |
|
48 "tabviewframeinitialized", onTabViewFrameInitialized, false); |
|
49 }); |
|
50 } |
|
51 |