michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: function test() { michael@0: waitForExplicitFinish(); michael@0: michael@0: newWindowWithTabView(function(win) { michael@0: let cw = win.TabView.getContentWindow(); michael@0: let groupItem = cw.GroupItems.groupItems[0]; michael@0: michael@0: // set the group to 180 x 100 so it shows two tab items without going into michael@0: // the stacked mode michael@0: groupItem.setBounds(new cw.Rect(100, 0, 180, 100)); michael@0: michael@0: hideTabView(function() { michael@0: groupItem.addSubscriber("childAdded", function onChildAdded(data) { michael@0: groupItem.removeSubscriber("childAdded", onChildAdded); michael@0: michael@0: is(groupItem.getChildren().length, 3, "The number of children in group is 3"); michael@0: ok(groupItem.isStacked(), "The group item is stacked after adding a new tab"); michael@0: michael@0: let tabItem = groupItem.getChild(2); michael@0: groupItem.addSubscriber("childRemoved", function onChildRemoved() { michael@0: tabItem.removeSubscriber("childRemoved", onChildRemoved); michael@0: michael@0: is(groupItem.getChildren().length, 2, "The number of children in group is 2"); michael@0: // give a delay for the active item to be set michael@0: executeSoon(function() { michael@0: showTabView(function() { michael@0: ok(!groupItem.isStacked(), "The group item is not stacked after removing a tab"); michael@0: finish(); michael@0: }, win); michael@0: }); michael@0: }); michael@0: win.BrowserCloseTabOrWindow(); michael@0: }); michael@0: win.gBrowser.loadOneTab("", {inBackground: true}); michael@0: }, win); michael@0: }, function(win) { michael@0: registerCleanupFunction(function () { michael@0: win.close(); michael@0: }); michael@0: michael@0: win.gBrowser.addTab(); michael@0: }); michael@0: }