|
1 function test() { |
|
2 var tab1 = gBrowser.selectedTab; |
|
3 var tab2 = gBrowser.addTab(); |
|
4 var childTab1; |
|
5 var childTab2; |
|
6 |
|
7 childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true }); |
|
8 gBrowser.selectedTab = childTab1; |
|
9 gBrowser.removeCurrentTab(); |
|
10 is(idx(gBrowser.selectedTab), idx(tab1), |
|
11 "closing a tab next to its parent selects the parent"); |
|
12 |
|
13 childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true }); |
|
14 gBrowser.selectedTab = tab2; |
|
15 gBrowser.selectedTab = childTab1; |
|
16 gBrowser.removeCurrentTab(); |
|
17 is(idx(gBrowser.selectedTab), idx(tab2), |
|
18 "closing a tab next to its parent doesn't select the parent if another tab had been selected ad interim"); |
|
19 |
|
20 gBrowser.selectedTab = tab1; |
|
21 childTab1 = gBrowser.addTab("about:blank", { relatedToCurrent: true }); |
|
22 childTab2 = gBrowser.addTab("about:blank", { relatedToCurrent: true }); |
|
23 gBrowser.selectedTab = childTab1; |
|
24 gBrowser.removeCurrentTab(); |
|
25 is(idx(gBrowser.selectedTab), idx(childTab2), |
|
26 "closing a tab next to its parent selects the next tab with the same parent"); |
|
27 gBrowser.removeCurrentTab(); |
|
28 is(idx(gBrowser.selectedTab), idx(tab2), |
|
29 "closing the last tab in a set of child tabs doesn't go back to the parent"); |
|
30 |
|
31 gBrowser.removeTab(tab2); |
|
32 } |
|
33 |
|
34 function idx(tab) { |
|
35 return Array.indexOf(gBrowser.tabs, tab); |
|
36 } |