Wed, 31 Dec 2014 06:09:35 +0100
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 | let openMoveToGroupPopup = function () { |
michael@0 | 6 | let tab = gBrowser.selectedTab; |
michael@0 | 7 | var evt = new Event(""); |
michael@0 | 8 | tab.dispatchEvent(evt); |
michael@0 | 9 | contextMenu.openPopup(tab, "end_after", 0, 0, true, false, evt); |
michael@0 | 10 | tvMenuPopup.openPopup(tvMenu, "end_after", 0, 0, true, false); |
michael@0 | 11 | } |
michael@0 | 12 | |
michael@0 | 13 | let hideMoveToGroupPopup = function () { |
michael@0 | 14 | tvMenuPopup.hidePopup(); |
michael@0 | 15 | contextMenu.hidePopup(); |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | let assertValidPrerequisites = function (visible) { |
michael@0 | 19 | let cw = TabView.getContentWindow(); |
michael@0 | 20 | is(cw.GroupItems.groupItems.length, 1, "there is one groupItem"); |
michael@0 | 21 | is(gBrowser.tabs.length, 1, "there is one tab"); |
michael@0 | 22 | is(TabView.isVisible(), visible, "tabview is visible"); |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | let tvMenu = document.getElementById("context_tabViewMenu"); |
michael@0 | 26 | let contextMenu = document.getElementById("tabContextMenu"); |
michael@0 | 27 | let tvMenuPopup = document.getElementById("context_tabViewMenuPopup"); |
michael@0 | 28 | |
michael@0 | 29 | waitForExplicitFinish(); |
michael@0 | 30 | |
michael@0 | 31 | registerCleanupFunction(function () { |
michael@0 | 32 | hideMoveToGroupPopup(); |
michael@0 | 33 | hideTabView(); |
michael@0 | 34 | |
michael@0 | 35 | let groupItems = TabView.getContentWindow().GroupItems.groupItems; |
michael@0 | 36 | if (groupItems.length > 1) |
michael@0 | 37 | closeGroupItem(groupItems[0]); |
michael@0 | 38 | }); |
michael@0 | 39 | |
michael@0 | 40 | showTabView(function () { |
michael@0 | 41 | assertValidPrerequisites(true); |
michael@0 | 42 | |
michael@0 | 43 | hideTabView(function () { |
michael@0 | 44 | let groupItem = createGroupItemWithBlankTabs(window, 200, 200, 10, 1); |
michael@0 | 45 | groupItem.setTitle("group2"); |
michael@0 | 46 | |
michael@0 | 47 | gBrowser.selectedTab = gBrowser.tabs[0]; |
michael@0 | 48 | |
michael@0 | 49 | executeSoon(function () { |
michael@0 | 50 | openMoveToGroupPopup(); |
michael@0 | 51 | is(tvMenuPopup.firstChild.getAttribute("label"), "group2", "menuItem is present"); |
michael@0 | 52 | hideMoveToGroupPopup(); |
michael@0 | 53 | |
michael@0 | 54 | closeGroupItem(groupItem, function () { |
michael@0 | 55 | openMoveToGroupPopup(); |
michael@0 | 56 | is(tvMenuPopup.firstChild.tagName, "menuseparator", "menuItem is not present"); |
michael@0 | 57 | hideMoveToGroupPopup(); |
michael@0 | 58 | |
michael@0 | 59 | assertValidPrerequisites(false); |
michael@0 | 60 | finish(); |
michael@0 | 61 | }); |
michael@0 | 62 | }); |
michael@0 | 63 | }); |
michael@0 | 64 | }); |
michael@0 | 65 | } |