browser/components/tabview/test/browser_tabview_bug612470.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

michael@0 1 /* Any copyright is dedicated to the Public Domain.
michael@0 2 http://creativecommons.org/publicdomain/zero/1.0/ */
michael@0 3
michael@0 4 // Tests that groups behave properly when closing all tabs but app tabs.
michael@0 5
michael@0 6 function test() {
michael@0 7 let cw, win, groupItem;
michael@0 8
michael@0 9 let onLoad = function (tvwin) {
michael@0 10 win = tvwin;
michael@0 11 registerCleanupFunction(function () win.close());
michael@0 12 win.gBrowser.pinTab(win.gBrowser.tabs[0]);
michael@0 13 win.gBrowser.loadOneTab("about:blank", {inBackground: true});
michael@0 14 };
michael@0 15
michael@0 16 let onShow = function () {
michael@0 17 cw = win.TabView.getContentWindow();
michael@0 18 is(cw.GroupItems.groupItems.length, 1, "There's only one group");
michael@0 19
michael@0 20 groupItem = createEmptyGroupItem(cw, 200, 200, 20);
michael@0 21 cw.UI.setActive(groupItem);
michael@0 22
michael@0 23 whenTabViewIsHidden(onHide, win);
michael@0 24 cw.UI.goToTab(win.gBrowser.tabs[0]);
michael@0 25 };
michael@0 26
michael@0 27 let onHide = function () {
michael@0 28 let tab = win.gBrowser.loadOneTab("about:blank", {inBackground: true});
michael@0 29 is(groupItem.getChildren().length, 1, "One tab is in the new group");
michael@0 30
michael@0 31 executeSoon(function () {
michael@0 32 is(win.gBrowser.visibleTabs.length, 2, "There are two tabs displayed");
michael@0 33 win.gBrowser.removeTab(tab);
michael@0 34
michael@0 35 is(groupItem.getChildren().length, 0, "No tabs are in the new group");
michael@0 36 is(win.gBrowser.visibleTabs.length, 1, "There is one tab displayed");
michael@0 37 is(cw.GroupItems.groupItems.length, 2, "There are two groups still");
michael@0 38
michael@0 39 finish();
michael@0 40 });
michael@0 41 };
michael@0 42
michael@0 43 waitForExplicitFinish();
michael@0 44
michael@0 45 newWindowWithTabView(onShow, onLoad);
michael@0 46 }

mercurial