browser/components/tabview/test/browser_tabview_bug686654.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     let cw = win.TabView.getContentWindow();
     9     let groupItem = cw.GroupItems.groupItems[0];
    11     // set the group to 180 x 100 so it shows two tab items without going into
    12     // the stacked mode
    13     groupItem.setBounds(new cw.Rect(100, 0, 180, 100));
    15     hideTabView(function() {
    16       groupItem.addSubscriber("childAdded", function onChildAdded(data) {
    17         groupItem.removeSubscriber("childAdded", onChildAdded);
    19         is(groupItem.getChildren().length, 3, "The number of children in group is 3");
    20         ok(groupItem.isStacked(), "The group item is stacked after adding a new tab");
    22         let tabItem = groupItem.getChild(2);
    23         groupItem.addSubscriber("childRemoved", function onChildRemoved() {
    24           tabItem.removeSubscriber("childRemoved", onChildRemoved);
    26           is(groupItem.getChildren().length, 2, "The number of children in group is 2");
    27           // give a delay for the active item to be set
    28           executeSoon(function() {
    29             showTabView(function() {
    30               ok(!groupItem.isStacked(), "The group item is not stacked after removing a tab");
    31               finish();
    32             }, win);
    33           });
    34         });
    35         win.BrowserCloseTabOrWindow();
    36       });
    37       win.gBrowser.loadOneTab("", {inBackground: true});
    38     }, win);
    39   }, function(win) {
    40     registerCleanupFunction(function () {
    41       win.close();
    42     });
    44     win.gBrowser.addTab();
    45   });
    46 }

mercurial