|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 let win, contentWindow, originalTab, newTab1, newTab2; |
|
6 |
|
7 let partOne = function () { |
|
8 let groupItem = contentWindow.GroupItems.groupItems[0]; |
|
9 let tabItems = groupItem.getChildren(); |
|
10 is(tabItems.length, 2, "There are two tab items in that group item"); |
|
11 is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab"); |
|
12 is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab"); |
|
13 |
|
14 hideTabView(partTwo, win); |
|
15 }; |
|
16 |
|
17 let partTwo = function () { |
|
18 win.gBrowser.unpinTab(newTab1); |
|
19 showTabView(partThree, win); |
|
20 }; |
|
21 |
|
22 let partThree = function () { |
|
23 let tabItems = contentWindow.GroupItems.groupItems[0].getChildren(); |
|
24 is(tabItems.length, 3, "There are three tab items in that group item"); |
|
25 is(tabItems[0].tab, win.gBrowser.tabs[0], "The first tab item is linked to the first tab"); |
|
26 is(tabItems[1].tab, win.gBrowser.tabs[1], "The second tab item is linked to the second tab"); |
|
27 is(tabItems[2].tab, win.gBrowser.tabs[2], "The third tab item is linked to the third tab"); |
|
28 |
|
29 finish(); |
|
30 }; |
|
31 |
|
32 let onLoad = function (tvwin) { |
|
33 win = tvwin; |
|
34 registerCleanupFunction(function () win.close()); |
|
35 |
|
36 for (let i = 0; i < 2; i++) |
|
37 win.gBrowser.loadOneTab("about:blank", {inBackground: true}); |
|
38 |
|
39 [originalTab, newTab1, newTab2] = win.gBrowser.tabs; |
|
40 win.gBrowser.pinTab(newTab1); |
|
41 }; |
|
42 |
|
43 let onShow = function () { |
|
44 contentWindow = win.TabView.getContentWindow(); |
|
45 is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item"); |
|
46 |
|
47 partOne(); |
|
48 }; |
|
49 |
|
50 waitForExplicitFinish(); |
|
51 newWindowWithTabView(onShow, onLoad); |
|
52 } |