browser/components/tabview/test/browser_tabview_bug733115.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_bug733115.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,41 @@
     1.4 +/* Any copyright is dedicated to the Public Domain.
     1.5 +   http://creativecommons.org/publicdomain/zero/1.0/ */
     1.6 +
     1.7 +function test() {
     1.8 +  waitForExplicitFinish();
     1.9 +
    1.10 +  showTabView(function() {
    1.11 +    registerCleanupFunction(function() {
    1.12 +      if (gBrowser.tabs[1])
    1.13 +        gBrowser.removeTab(gBrowser.tabs[1]);
    1.14 +      TabView.hide();
    1.15 +    });
    1.16 +
    1.17 +    let contentWindow = TabView.getContentWindow();
    1.18 +    let groupItem = createEmptyGroupItem(contentWindow, 200, 200, 20);
    1.19 +    contentWindow.GroupItems.setActiveGroupItem(groupItem);
    1.20 +
    1.21 +    // A new tab should be added to the active group and tabview should zoom into it.
    1.22 +    is(groupItem.getChildren().length, 0, "This group doesn't have any tabitems");
    1.23 +    whenTabViewIsHidden(function() {
    1.24 +      is(groupItem.getChildren().length, 1, "This group has one tabitem");
    1.25 +
    1.26 +      showTabView(function() {
    1.27 +        // Ensure that no new tab is added to this non-empty tab group.
    1.28 +        whenTabViewIsHidden(function() {
    1.29 +          let tabItems = groupItem.getChildren();
    1.30 +          is(tabItems.length, 1, "This group has one tabitem");
    1.31 +          is(tabItems[0].tab, gBrowser.selectedTab, "The same tab");
    1.32 +
    1.33 +          tabItems[0].close();
    1.34 +          groupItem.close();
    1.35 +
    1.36 +          finish();
    1.37 +        });
    1.38 +        EventUtils.synthesizeKey("VK_RETURN", {}, contentWindow);
    1.39 +      });
    1.40 +    });
    1.41 +    EventUtils.synthesizeKey("VK_RETURN", {}, contentWindow);
    1.42 +  });
    1.43 +}
    1.44 +

mercurial