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