1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug696602.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* Any copyright is dedicated to the Public Domain. 1.5 + http://creativecommons.org/publicdomain/zero/1.0/ */ 1.6 +let win; 1.7 + 1.8 +function test() { 1.9 + waitForExplicitFinish(); 1.10 + 1.11 + newWindowWithTabView(function(newWin) { 1.12 + win = newWin; 1.13 + 1.14 + registerCleanupFunction(function() { 1.15 + win.close(); 1.16 + }); 1.17 + 1.18 + let cw = win.TabView.getContentWindow(); 1.19 + let groupItemOne = cw.GroupItems.groupItems[0]; 1.20 + let groupItemTwo = createGroupItemWithBlankTabs(win, 300, 300, 20, 10); 1.21 + 1.22 + is(win.gBrowser.tabContainer.getAttribute("overflow"), "true", 1.23 + "The tabstrip is overflow"); 1.24 + 1.25 + is(groupItemOne.getChildren().length, 10, "Group one has 10 tabs"); 1.26 + is(groupItemTwo.getChildren().length, 10, "Group two has 10 tabs"); 1.27 + 1.28 + checkSelectedTabVisible("two", function() { 1.29 + showTabView(function() { 1.30 + checkSelectedTabVisible("one", finish); 1.31 + groupItemOne.getChild(9).zoomIn(); 1.32 + }, win); 1.33 + }); 1.34 + groupItemTwo.getChild(9).zoomIn(); 1.35 + }, function(newWin) { 1.36 + for (let i = 0; i < 9; i++) 1.37 + newWin.gBrowser.addTab(); 1.38 + }); 1.39 +} 1.40 + 1.41 +function isSelectedTabVisible() { 1.42 + let tabstrip = win.gBrowser.tabContainer.mTabstrip; 1.43 + let scrollRect = tabstrip.scrollClientRect; 1.44 + let tab = win.gBrowser.selectedTab.getBoundingClientRect(); 1.45 + 1.46 + return (scrollRect.left <= tab.left && tab.right <= scrollRect.right); 1.47 +} 1.48 + 1.49 +function checkSelectedTabVisible(groupName, callback) { 1.50 + whenTabViewIsHidden(function() { 1.51 + ok(isSelectedTabVisible(), "Group " + groupName + " selected tab is visible"); 1.52 + callback(); 1.53 + }, win); 1.54 +}