browser/components/tabview/test/browser_tabview_bug628887.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial