browser/components/tabview/test/browser_tabview_bug606905.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   let newTabs = []
     8   // add enough tabs so the close buttons are hidden and then check the closebuttons attribute
     9   do {
    10     let newTab = gBrowser.addTab("about:blank", {skipAnimation: true});
    11     newTabs.push(newTab);
    12   } while (gBrowser.visibleTabs[0].getBoundingClientRect().width > gBrowser.tabContainer.mTabClipWidth)
    14   // a setTimeout() in addTab is used to trigger adjustTabstrip() so we need a delay here as well.
    15   executeSoon(function() {
    16     is(gBrowser.tabContainer.getAttribute("closebuttons"), "activetab", "Only show button on selected tab.");
    18     // move a tab to another group and check the closebuttons attribute
    19     TabView._initFrame(function() {
    20       TabView.moveTabTo(newTabs[newTabs.length - 1], null);
    21       ok(gBrowser.visibleTabs[0].getBoundingClientRect().width > gBrowser.tabContainer.mTabClipWidth, 
    22          "Tab width is bigger than tab clip width");
    23       is(gBrowser.tabContainer.getAttribute("closebuttons"), "", "Show button on all tabs.")
    25       // clean up and finish
    26       newTabs.forEach(function(tab) {
    27         gBrowser.removeTab(tab);
    28       });
    29       finish();
    30     });
    31   });
    32 }

mercurial