browser/components/tabview/test/browser_tabview_bug733115.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 showTabView(function() {
michael@0 8 registerCleanupFunction(function() {
michael@0 9 if (gBrowser.tabs[1])
michael@0 10 gBrowser.removeTab(gBrowser.tabs[1]);
michael@0 11 TabView.hide();
michael@0 12 });
michael@0 13
michael@0 14 let contentWindow = TabView.getContentWindow();
michael@0 15 let groupItem = createEmptyGroupItem(contentWindow, 200, 200, 20);
michael@0 16 contentWindow.GroupItems.setActiveGroupItem(groupItem);
michael@0 17
michael@0 18 // A new tab should be added to the active group and tabview should zoom into it.
michael@0 19 is(groupItem.getChildren().length, 0, "This group doesn't have any tabitems");
michael@0 20 whenTabViewIsHidden(function() {
michael@0 21 is(groupItem.getChildren().length, 1, "This group has one tabitem");
michael@0 22
michael@0 23 showTabView(function() {
michael@0 24 // Ensure that no new tab is added to this non-empty tab group.
michael@0 25 whenTabViewIsHidden(function() {
michael@0 26 let tabItems = groupItem.getChildren();
michael@0 27 is(tabItems.length, 1, "This group has one tabitem");
michael@0 28 is(tabItems[0].tab, gBrowser.selectedTab, "The same tab");
michael@0 29
michael@0 30 tabItems[0].close();
michael@0 31 groupItem.close();
michael@0 32
michael@0 33 finish();
michael@0 34 });
michael@0 35 EventUtils.synthesizeKey("VK_RETURN", {}, contentWindow);
michael@0 36 });
michael@0 37 });
michael@0 38 EventUtils.synthesizeKey("VK_RETURN", {}, contentWindow);
michael@0 39 });
michael@0 40 }
michael@0 41

mercurial