1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug634672.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,52 @@ 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 + let cw; 1.9 + let win; 1.10 + 1.11 + waitForExplicitFinish(); 1.12 + 1.13 + newWindowWithTabView(function (tvwin) { 1.14 + win = tvwin; 1.15 + cw = win.TabView.getContentWindow(); 1.16 + 1.17 + registerCleanupFunction(function () { 1.18 + if (win && !win.closed) 1.19 + win.close(); 1.20 + }); 1.21 + 1.22 + // fill the group item with some tabs 1.23 + for (let i = 0; i < 5; i++) 1.24 + win.gBrowser.loadOneTab("about:blank"); 1.25 + 1.26 + let groupItem = cw.GroupItems.groupItems[0]; 1.27 + groupItem.setSize(400, 400, true); 1.28 + let range = new cw.Range(1, 400); 1.29 + 1.30 + // determine the groupItem's largest possible stacked size 1.31 + while (range.extent > 1) { 1.32 + let pivot = Math.floor(range.extent / 2); 1.33 + groupItem.setSize(range.min + pivot, range.min + pivot, true); 1.34 + 1.35 + if (groupItem.isStacked()) 1.36 + range.min += pivot; 1.37 + else 1.38 + range.max -= pivot; 1.39 + } 1.40 + 1.41 + // stack the group 1.42 + groupItem.setSize(range.min, range.min, true); 1.43 + ok(groupItem.isStacked(), "groupItem is stacked"); 1.44 + 1.45 + // one step back to un-stack the groupItem 1.46 + groupItem.setSize(range.max, range.max, true); 1.47 + ok(!groupItem.isStacked(), "groupItem is no longer stacked"); 1.48 + 1.49 + // check that close buttons are visible 1.50 + let tabItem = groupItem.getChild(0); 1.51 + isnot(tabItem.$close.css("display"), "none", "close button is visible"); 1.52 + 1.53 + finish(); 1.54 + }); 1.55 +}