1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug628887.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 + 1.7 +function test() { 1.8 + waitForExplicitFinish(); 1.9 + 1.10 + newWindowWithTabView(function(win) { 1.11 + registerCleanupFunction(function() win.close()); 1.12 + 1.13 + let cw = win.TabView.getContentWindow(); 1.14 + let groupItemOne = cw.GroupItems.groupItems[0]; 1.15 + 1.16 + let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2); 1.17 + ok(groupItemTwo.isStacked(), "groupItem is now stacked"); 1.18 + 1.19 + is(win.gBrowser.tabs.length, 3, "There are three tabs"); 1.20 + 1.21 + // the focus should remain within the group after it's expanded 1.22 + groupItemTwo.addSubscriber("expanded", function onExpanded() { 1.23 + groupItemTwo.removeSubscriber("expanded", onExpanded); 1.24 + 1.25 + ok(groupItemTwo.expanded, "groupItemTwo is expanded"); 1.26 + is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), 1.27 + "The first tab item in group item two is active in expanded mode"); 1.28 + 1.29 + EventUtils.synthesizeKey("VK_DOWN", {}, cw); 1.30 + is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), 1.31 + "The first tab item is still active after pressing down key"); 1.32 + 1.33 + // the focus should goes to other group if the down arrow is pressed 1.34 + groupItemTwo.addSubscriber("collapsed", function onExpanded() { 1.35 + groupItemTwo.removeSubscriber("collapsed", onExpanded); 1.36 + 1.37 + ok(!groupItemTwo.expanded, "groupItemTwo is not expanded"); 1.38 + is(cw.UI.getActiveTab(), groupItemTwo.getChild(0), 1.39 + "The first tab item is active in group item two in collapsed mode"); 1.40 + 1.41 + EventUtils.synthesizeKey("VK_DOWN", {}, cw); 1.42 + is(cw.UI.getActiveTab(), groupItemOne.getChild(0), 1.43 + "The first tab item in group item one is active after pressing down key"); 1.44 + 1.45 + finish(); 1.46 + }); 1.47 + 1.48 + groupItemTwo.collapse(); 1.49 + }); 1.50 + 1.51 + groupItemTwo.expand(); 1.52 + }); 1.53 +}