browser/components/tabview/test/browser_tabview_bug696602.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:92d82bcf5adc
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
3 let win;
4
5 function test() {
6 waitForExplicitFinish();
7
8 newWindowWithTabView(function(newWin) {
9 win = newWin;
10
11 registerCleanupFunction(function() {
12 win.close();
13 });
14
15 let cw = win.TabView.getContentWindow();
16 let groupItemOne = cw.GroupItems.groupItems[0];
17 let groupItemTwo = createGroupItemWithBlankTabs(win, 300, 300, 20, 10);
18
19 is(win.gBrowser.tabContainer.getAttribute("overflow"), "true",
20 "The tabstrip is overflow");
21
22 is(groupItemOne.getChildren().length, 10, "Group one has 10 tabs");
23 is(groupItemTwo.getChildren().length, 10, "Group two has 10 tabs");
24
25 checkSelectedTabVisible("two", function() {
26 showTabView(function() {
27 checkSelectedTabVisible("one", finish);
28 groupItemOne.getChild(9).zoomIn();
29 }, win);
30 });
31 groupItemTwo.getChild(9).zoomIn();
32 }, function(newWin) {
33 for (let i = 0; i < 9; i++)
34 newWin.gBrowser.addTab();
35 });
36 }
37
38 function isSelectedTabVisible() {
39 let tabstrip = win.gBrowser.tabContainer.mTabstrip;
40 let scrollRect = tabstrip.scrollClientRect;
41 let tab = win.gBrowser.selectedTab.getBoundingClientRect();
42
43 return (scrollRect.left <= tab.left && tab.right <= scrollRect.right);
44 }
45
46 function checkSelectedTabVisible(groupName, callback) {
47 whenTabViewIsHidden(function() {
48 ok(isSelectedTabVisible(), "Group " + groupName + " selected tab is visible");
49 callback();
50 }, win);
51 }

mercurial