1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/components/tabview/test/browser_tabview_bug686654.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,46 @@ 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 + waitForExplicitFinish(); 1.9 + 1.10 + newWindowWithTabView(function(win) { 1.11 + let cw = win.TabView.getContentWindow(); 1.12 + let groupItem = cw.GroupItems.groupItems[0]; 1.13 + 1.14 + // set the group to 180 x 100 so it shows two tab items without going into 1.15 + // the stacked mode 1.16 + groupItem.setBounds(new cw.Rect(100, 0, 180, 100)); 1.17 + 1.18 + hideTabView(function() { 1.19 + groupItem.addSubscriber("childAdded", function onChildAdded(data) { 1.20 + groupItem.removeSubscriber("childAdded", onChildAdded); 1.21 + 1.22 + is(groupItem.getChildren().length, 3, "The number of children in group is 3"); 1.23 + ok(groupItem.isStacked(), "The group item is stacked after adding a new tab"); 1.24 + 1.25 + let tabItem = groupItem.getChild(2); 1.26 + groupItem.addSubscriber("childRemoved", function onChildRemoved() { 1.27 + tabItem.removeSubscriber("childRemoved", onChildRemoved); 1.28 + 1.29 + is(groupItem.getChildren().length, 2, "The number of children in group is 2"); 1.30 + // give a delay for the active item to be set 1.31 + executeSoon(function() { 1.32 + showTabView(function() { 1.33 + ok(!groupItem.isStacked(), "The group item is not stacked after removing a tab"); 1.34 + finish(); 1.35 + }, win); 1.36 + }); 1.37 + }); 1.38 + win.BrowserCloseTabOrWindow(); 1.39 + }); 1.40 + win.gBrowser.loadOneTab("", {inBackground: true}); 1.41 + }, win); 1.42 + }, function(win) { 1.43 + registerCleanupFunction(function () { 1.44 + win.close(); 1.45 + }); 1.46 + 1.47 + win.gBrowser.addTab(); 1.48 + }); 1.49 +}