|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 function test() { |
|
5 waitForExplicitFinish(); |
|
6 |
|
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) |
|
13 |
|
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."); |
|
17 |
|
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.") |
|
24 |
|
25 // clean up and finish |
|
26 newTabs.forEach(function(tab) { |
|
27 gBrowser.removeTab(tab); |
|
28 }); |
|
29 finish(); |
|
30 }); |
|
31 }); |
|
32 } |