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.

     1 /* Any copyright is dedicated to the Public Domain.
     2    http://creativecommons.org/publicdomain/zero/1.0/ */
     4 function test() {
     5   waitForExplicitFinish();
     7   newWindowWithTabView(function(win) {
     8     registerCleanupFunction(function() win.close());
    10     let cw = win.TabView.getContentWindow();
    11     let groupItemOne = cw.GroupItems.groupItems[0];
    13     let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2);
    14     ok(groupItemTwo.isStacked(), "groupItem is now stacked");
    16     is(win.gBrowser.tabs.length, 3, "There are three tabs");
    18     // the focus should remain within the group after it's expanded
    19     groupItemTwo.addSubscriber("expanded", function onExpanded() {
    20       groupItemTwo.removeSubscriber("expanded", onExpanded);
    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");
    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");
    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);
    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");
    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");
    42         finish();
    43       });
    45       groupItemTwo.collapse();
    46     });
    48     groupItemTwo.expand();
    49   });
    50 }

mercurial