browser/components/tabview/test/browser_tabview_bug686654.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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 function test() {
michael@0 5 waitForExplicitFinish();
michael@0 6
michael@0 7 newWindowWithTabView(function(win) {
michael@0 8 let cw = win.TabView.getContentWindow();
michael@0 9 let groupItem = cw.GroupItems.groupItems[0];
michael@0 10
michael@0 11 // set the group to 180 x 100 so it shows two tab items without going into
michael@0 12 // the stacked mode
michael@0 13 groupItem.setBounds(new cw.Rect(100, 0, 180, 100));
michael@0 14
michael@0 15 hideTabView(function() {
michael@0 16 groupItem.addSubscriber("childAdded", function onChildAdded(data) {
michael@0 17 groupItem.removeSubscriber("childAdded", onChildAdded);
michael@0 18
michael@0 19 is(groupItem.getChildren().length, 3, "The number of children in group is 3");
michael@0 20 ok(groupItem.isStacked(), "The group item is stacked after adding a new tab");
michael@0 21
michael@0 22 let tabItem = groupItem.getChild(2);
michael@0 23 groupItem.addSubscriber("childRemoved", function onChildRemoved() {
michael@0 24 tabItem.removeSubscriber("childRemoved", onChildRemoved);
michael@0 25
michael@0 26 is(groupItem.getChildren().length, 2, "The number of children in group is 2");
michael@0 27 // give a delay for the active item to be set
michael@0 28 executeSoon(function() {
michael@0 29 showTabView(function() {
michael@0 30 ok(!groupItem.isStacked(), "The group item is not stacked after removing a tab");
michael@0 31 finish();
michael@0 32 }, win);
michael@0 33 });
michael@0 34 });
michael@0 35 win.BrowserCloseTabOrWindow();
michael@0 36 });
michael@0 37 win.gBrowser.loadOneTab("", {inBackground: true});
michael@0 38 }, win);
michael@0 39 }, function(win) {
michael@0 40 registerCleanupFunction(function () {
michael@0 41 win.close();
michael@0 42 });
michael@0 43
michael@0 44 win.gBrowser.addTab();
michael@0 45 });
michael@0 46 }

mercurial