browser/components/tabview/test/browser_tabview_bug686654.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     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