|
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 registerCleanupFunction(function() win.close()); |
|
9 |
|
10 let cw = win.TabView.getContentWindow(); |
|
11 let groupItemOne = cw.GroupItems.groupItems[0]; |
|
12 |
|
13 let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2); |
|
14 ok(groupItemTwo.isStacked(), "groupItem is now stacked"); |
|
15 |
|
16 is(win.gBrowser.tabs.length, 3, "There are three tabs"); |
|
17 |
|
18 // the focus should remain within the group after it's expanded |
|
19 groupItemTwo.addSubscriber("expanded", function onExpanded() { |
|
20 groupItemTwo.removeSubscriber("expanded", onExpanded); |
|
21 |
|
22 ok(groupItemTwo.expanded, "groupItemTwo is expanded"); |
|
23 is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), |
|
24 "The first tab item in group item two is active in expanded mode"); |
|
25 |
|
26 EventUtils.synthesizeKey("VK_DOWN", {}, cw); |
|
27 is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), |
|
28 "The first tab item is still active after pressing down key"); |
|
29 |
|
30 // the focus should goes to other group if the down arrow is pressed |
|
31 groupItemTwo.addSubscriber("collapsed", function onExpanded() { |
|
32 groupItemTwo.removeSubscriber("collapsed", onExpanded); |
|
33 |
|
34 ok(!groupItemTwo.expanded, "groupItemTwo is not expanded"); |
|
35 is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), |
|
36 "The first tab item is active in group item two in collapsed mode"); |
|
37 |
|
38 EventUtils.synthesizeKey("VK_DOWN", {}, cw); |
|
39 is(cw.UI.getActiveTab(), groupItemOne.getChild(0), |
|
40 "The first tab item in group item one is active after pressing down key"); |
|
41 |
|
42 finish(); |
|
43 }); |
|
44 |
|
45 groupItemTwo.collapse(); |
|
46 }); |
|
47 |
|
48 groupItemTwo.expand(); |
|
49 }); |
|
50 } |