browser/components/tabview/test/browser_tabview_bug612470.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/components/tabview/test/browser_tabview_bug612470.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +// Tests that groups behave properly when closing all tabs but app tabs.
     1.8 +
     1.9 +function test() {
    1.10 +  let cw, win, groupItem;
    1.11 +
    1.12 +  let onLoad = function (tvwin) {
    1.13 +    win = tvwin;
    1.14 +    registerCleanupFunction(function () win.close());
    1.15 +    win.gBrowser.pinTab(win.gBrowser.tabs[0]);
    1.16 +    win.gBrowser.loadOneTab("about:blank", {inBackground: true});
    1.17 +  };
    1.18 +
    1.19 +  let onShow = function () {
    1.20 +    cw = win.TabView.getContentWindow();
    1.21 +    is(cw.GroupItems.groupItems.length, 1, "There's only one group");
    1.22 +
    1.23 +    groupItem = createEmptyGroupItem(cw, 200, 200, 20);
    1.24 +    cw.UI.setActive(groupItem);
    1.25 +
    1.26 +    whenTabViewIsHidden(onHide, win);
    1.27 +    cw.UI.goToTab(win.gBrowser.tabs[0]);
    1.28 +  };
    1.29 +
    1.30 +  let onHide = function () {
    1.31 +    let tab = win.gBrowser.loadOneTab("about:blank", {inBackground: true});
    1.32 +    is(groupItem.getChildren().length, 1, "One tab is in the new group");
    1.33 +
    1.34 +    executeSoon(function () {
    1.35 +      is(win.gBrowser.visibleTabs.length, 2, "There are two tabs displayed");
    1.36 +      win.gBrowser.removeTab(tab);
    1.37 +
    1.38 +      is(groupItem.getChildren().length, 0, "No tabs are in the new group");
    1.39 +      is(win.gBrowser.visibleTabs.length, 1, "There is one tab displayed");
    1.40 +      is(cw.GroupItems.groupItems.length, 2, "There are two groups still");
    1.41 +
    1.42 +      finish();
    1.43 +    });
    1.44 +  };
    1.45 +
    1.46 +  waitForExplicitFinish();
    1.47 +
    1.48 +  newWindowWithTabView(onShow, onLoad);
    1.49 +}

mercurial