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.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 function test() {
5 waitForExplicitFinish();
7 let tContextMenu = document.getElementById("tabContextMenu");
8 let tvMenuPopup = document.getElementById("context_tabViewMenuPopup");
9 let group1;
10 let group2;
12 function openMoveToGroupPopup() {
13 let tab = gBrowser.selectedTab;
14 let tvMenu = document.getElementById("context_tabViewMenu");
15 let tvMenuPopup = document.getElementById("context_tabViewMenuPopup");
16 let tvEvent = new Event("");
18 tab.dispatchEvent(tvEvent);
19 tContextMenu.openPopup(tab, "end_after", 0, 0, true, false, tvEvent);
20 tvMenuPopup.openPopup(tvMenu, "end_after", 0, 0, true, false);
21 }
23 function hideMoveToGroupPopup() {
24 tvMenuPopup.hidePopup();
25 tContextMenu.hidePopup();
26 }
28 function createGroups() {
29 let cw = TabView.getContentWindow();
31 group1 = createGroupItemWithTabs(window, 200, 200, 20, ["about:blank"]);
32 group1.setTitle("group with items and title");
33 group2 = createEmptyGroupItem(cw, 200, 200, 20);
34 cw.UI.setActive(cw.GroupItems.groupItems[0]);
36 // Check the group count.
37 is(cw.GroupItems.groupItems.length, 3, "Validate group count in tab view.");
39 hideTabView(checkGroupMenuItems);
40 }
42 // The group count includes the separator and the 'new group' menu item.
43 function checkGroupMenuItems() {
44 // First test with an empty untitled group.
45 openMoveToGroupPopup();
46 is(tvMenuPopup.childNodes.length, 3, "Validate group item count in move to group popup.");
47 hideMoveToGroupPopup();
49 // Then test with an empty but titled group.
50 group2.setTitle("empty group with title");
51 openMoveToGroupPopup();
52 is(tvMenuPopup.childNodes.length, 4, "Validate group item count in move to group popup.");
53 hideMoveToGroupPopup();
55 // Clean
56 closeGroupItem(group1, function() { closeGroupItem(group2, finish); });
57 }
59 showTabView(createGroups);
60 }