mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 593645 - Use popup.triggerNode for tab context menu - tests. r=dao
This commit is contained in:
parent
75e13ed8fd
commit
bdb01440f4
@ -91,6 +91,7 @@ endif
|
||||
# browser_bug321000.js is disabled because newline handling is shaky (bug 592528)
|
||||
|
||||
_BROWSER_FILES = \
|
||||
head.js \
|
||||
browser_typeAheadFind.js \
|
||||
browser_keywordSearch.js \
|
||||
browser_allTabsPanel.js \
|
||||
|
@ -4,9 +4,7 @@ function numClosedTabs()
|
||||
getClosedTabCount(window);
|
||||
|
||||
function isUndoCloseEnabled() {
|
||||
document.popupNode = gBrowser.tabs[0];
|
||||
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
|
||||
TabContextMenu.contextTab = null;
|
||||
updateTabContextMenu();
|
||||
return !document.getElementById("context_undoCloseTab").disabled;
|
||||
}
|
||||
|
||||
|
@ -89,15 +89,11 @@ function test() {
|
||||
}
|
||||
|
||||
function Disabled() {
|
||||
document.popupNode = gBrowser.selectedTab;
|
||||
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
|
||||
TabContextMenu.contextTab = null;
|
||||
updateTabContextMenu();
|
||||
return document.getElementById("Browser:BookmarkAllTabs").getAttribute("disabled") == "true";
|
||||
}
|
||||
|
||||
function Hidden() {
|
||||
document.popupNode = gBrowser.selectedTab;
|
||||
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
|
||||
TabContextMenu.contextTab = null;
|
||||
updateTabContextMenu();
|
||||
return document.getElementById("context_bookmarkAllTabs").hidden;
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ function test() {
|
||||
is(gBrowser.visibleTabs.length, 2, "there are now two visible tabs");
|
||||
|
||||
// Check the context menu with two tabs
|
||||
popup(origTab);
|
||||
updateTabContextMenu(origTab);
|
||||
is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled");
|
||||
is(document.getElementById("context_reloadAllTabs").disabled, false, "Reload All Tabs is enabled");
|
||||
|
||||
@ -53,7 +53,7 @@ function test() {
|
||||
is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
|
||||
|
||||
// Check the context menu with one tab.
|
||||
popup(testTab);
|
||||
updateTabContextMenu(testTab);
|
||||
is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
|
||||
is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
|
||||
|
||||
@ -64,7 +64,7 @@ function test() {
|
||||
is(gBrowser.visibleTabs.length, 2, "now there are two visible tabs");
|
||||
|
||||
// Check the context menu on the unpinned visible tab
|
||||
popup(testTab);
|
||||
updateTabContextMenu(testTab);
|
||||
is(document.getElementById("context_closeOtherTabs").disabled, true, "Close Other Tabs is disabled");
|
||||
|
||||
// Show all tabs
|
||||
@ -72,16 +72,9 @@ function test() {
|
||||
gBrowser.showOnlyTheseTabs(allTabs);
|
||||
|
||||
// Check the context menu now
|
||||
popup(testTab);
|
||||
updateTabContextMenu(testTab);
|
||||
is(document.getElementById("context_closeOtherTabs").disabled, false, "Close Other Tabs is enabled");
|
||||
|
||||
gBrowser.removeTab(testTab);
|
||||
gBrowser.removeTab(pinned);
|
||||
}
|
||||
|
||||
function popup(tab) {
|
||||
document.popupNode = tab;
|
||||
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
|
||||
is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
|
||||
TabContextMenu.contextTab = null;
|
||||
}
|
||||
|
8
browser/base/content/test/head.js
Normal file
8
browser/base/content/test/head.js
Normal file
@ -0,0 +1,8 @@
|
||||
function updateTabContextMenu(tab) {
|
||||
let menu = document.getElementById("tabContextMenu");
|
||||
if (!tab)
|
||||
tab = gBrowser.selectedTab;
|
||||
menu.openPopup(tab, "end_after", 0, 0, true, false, {target: tab});
|
||||
is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
|
||||
menu.hidePopup();
|
||||
}
|
@ -47,9 +47,10 @@ function test() {
|
||||
}
|
||||
|
||||
function popup(tab) {
|
||||
document.popupNode = tab;
|
||||
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
|
||||
let menu = document.getElementById("tabContextMenu");
|
||||
menu.openPopup(tab, "end_after", 0, 0, true, false, {target: tab});
|
||||
TabContextMenu.updateContextMenu(menu);
|
||||
is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
|
||||
TabContextMenu.contextTab = null;
|
||||
menu.hidePopup();
|
||||
}
|
||||
|
||||
|
@ -138,9 +138,8 @@ function test3(win) {
|
||||
}
|
||||
|
||||
function openTabContextPopup(win, tab) {
|
||||
win.document.popupNode = tab;
|
||||
win.document.getElementById("tabContextMenu").openPopup(
|
||||
tab, "end_after", 0, 0, true, false);
|
||||
tab, "end_after", 0, 0, true, false, {target: tab});
|
||||
}
|
||||
|
||||
function closeTabContextPopup(win) {
|
||||
|
@ -4,8 +4,7 @@
|
||||
function test() {
|
||||
let openMoveToGroupPopup = function () {
|
||||
let tab = gBrowser.selectedTab;
|
||||
document.popupNode = tab;
|
||||
contextMenu.openPopup(tab, "end_after", 0, 0, true, false);
|
||||
contextMenu.openPopup(tab, "end_after", 0, 0, true, false, {target: tab});
|
||||
tvMenuPopup.openPopup(tvMenu, "end_after", 0, 0, true, false);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user