browser/components/tabview/test/browser_tabview_bug606905.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_bug606905.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,32 @@
     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 +  let newTabs = []
    1.11 +  // add enough tabs so the close buttons are hidden and then check the closebuttons attribute
    1.12 +  do {
    1.13 +    let newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
    1.14 +    newTabs.push(newTab);
    1.15 +  } while (gBrowser.visibleTabs[0].getBoundingClientRect().width > gBrowser.tabContainer.mTabClipWidth)
    1.16 +
    1.17 +  // a setTimeout() in addTab is used to trigger adjustTabstrip() so we need a delay here as well.
    1.18 +  executeSoon(function() {
    1.19 +    is(gBrowser.tabContainer.getAttribute("closebuttons"), "activetab", "Only show button on selected tab.");
    1.20 +
    1.21 +    // move a tab to another group and check the closebuttons attribute
    1.22 +    TabView._initFrame(function() {
    1.23 +      TabView.moveTabTo(newTabs[newTabs.length - 1], null);
    1.24 +      ok(gBrowser.visibleTabs[0].getBoundingClientRect().width > gBrowser.tabContainer.mTabClipWidth, 
    1.25 +         "Tab width is bigger than tab clip width");
    1.26 +      is(gBrowser.tabContainer.getAttribute("closebuttons"), "", "Show button on all tabs.")
    1.27 +
    1.28 +      // clean up and finish
    1.29 +      newTabs.forEach(function(tab) {
    1.30 +        gBrowser.removeTab(tab);
    1.31 +      });
    1.32 +      finish();
    1.33 +    });
    1.34 +  });
    1.35 +}

mercurial