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: let openMoveToGroupPopup = function () { michael@0: let tab = gBrowser.selectedTab; michael@0: var evt = new Event(""); michael@0: tab.dispatchEvent(evt); michael@0: contextMenu.openPopup(tab, "end_after", 0, 0, true, false, evt); michael@0: tvMenuPopup.openPopup(tvMenu, "end_after", 0, 0, true, false); michael@0: } michael@0: michael@0: let hideMoveToGroupPopup = function () { michael@0: tvMenuPopup.hidePopup(); michael@0: contextMenu.hidePopup(); michael@0: } michael@0: michael@0: let assertValidPrerequisites = function (visible) { michael@0: let cw = TabView.getContentWindow(); michael@0: is(cw.GroupItems.groupItems.length, 1, "there is one groupItem"); michael@0: is(gBrowser.tabs.length, 1, "there is one tab"); michael@0: is(TabView.isVisible(), visible, "tabview is visible"); michael@0: } michael@0: michael@0: let tvMenu = document.getElementById("context_tabViewMenu"); michael@0: let contextMenu = document.getElementById("tabContextMenu"); michael@0: let tvMenuPopup = document.getElementById("context_tabViewMenuPopup"); michael@0: michael@0: waitForExplicitFinish(); michael@0: michael@0: registerCleanupFunction(function () { michael@0: hideMoveToGroupPopup(); michael@0: hideTabView(); michael@0: michael@0: let groupItems = TabView.getContentWindow().GroupItems.groupItems; michael@0: if (groupItems.length > 1) michael@0: closeGroupItem(groupItems[0]); michael@0: }); michael@0: michael@0: showTabView(function () { michael@0: assertValidPrerequisites(true); michael@0: michael@0: hideTabView(function () { michael@0: let groupItem = createGroupItemWithBlankTabs(window, 200, 200, 10, 1); michael@0: groupItem.setTitle("group2"); michael@0: michael@0: gBrowser.selectedTab = gBrowser.tabs[0]; michael@0: michael@0: executeSoon(function () { michael@0: openMoveToGroupPopup(); michael@0: is(tvMenuPopup.firstChild.getAttribute("label"), "group2", "menuItem is present"); michael@0: hideMoveToGroupPopup(); michael@0: michael@0: closeGroupItem(groupItem, function () { michael@0: openMoveToGroupPopup(); michael@0: is(tvMenuPopup.firstChild.tagName, "menuseparator", "menuItem is not present"); michael@0: hideMoveToGroupPopup(); michael@0: michael@0: assertValidPrerequisites(false); michael@0: finish(); michael@0: }); michael@0: }); michael@0: }); michael@0: }); michael@0: }