michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(function(win) { michael@0: registerCleanupFunction(function() win.close()); michael@0: michael@0: let cw = win.TabView.getContentWindow(); michael@0: let groupItemOne = cw.GroupItems.groupItems[0]; michael@0: michael@0: let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2); michael@0: ok(groupItemTwo.isStacked(), "groupItem is now stacked"); michael@0: michael@0: is(win.gBrowser.tabs.length, 3, "There are three tabs"); michael@0: michael@0: // the focus should remain within the group after it's expanded michael@0: groupItemTwo.addSubscriber("expanded", function onExpanded() { michael@0: groupItemTwo.removeSubscriber("expanded", onExpanded); michael@0: michael@0: ok(groupItemTwo.expanded, "groupItemTwo is expanded"); michael@0: is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), michael@0: "The first tab item in group item two is active in expanded mode"); michael@0: michael@0: EventUtils.synthesizeKey("VK_DOWN", {}, cw); michael@0: is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), michael@0: "The first tab item is still active after pressing down key"); michael@0: michael@0: // the focus should goes to other group if the down arrow is pressed michael@0: groupItemTwo.addSubscriber("collapsed", function onExpanded() { michael@0: groupItemTwo.removeSubscriber("collapsed", onExpanded); michael@0: michael@0: ok(!groupItemTwo.expanded, "groupItemTwo is not expanded"); michael@0: is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), michael@0: "The first tab item is active in group item two in collapsed mode"); michael@0: michael@0: EventUtils.synthesizeKey("VK_DOWN", {}, cw); michael@0: is(cw.UI.getActiveTab(), groupItemOne.getChild(0), michael@0: "The first tab item in group item one is active after pressing down key"); michael@0: michael@0: finish(); michael@0: }); michael@0: michael@0: groupItemTwo.collapse(); michael@0: }); michael@0: michael@0: groupItemTwo.expand(); michael@0: }); michael@0: }