mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-07 16:28:38 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
50
dom/html/test/browser_content_contextmenu_userinput.js
Normal file
50
dom/html/test/browser_content_contextmenu_userinput.js
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use strict";
|
||||
|
||||
const kPage = "http://example.org/browser/" +
|
||||
"dom/html/test/file_content_contextmenu.html";
|
||||
|
||||
add_task(function* () {
|
||||
yield BrowserTestUtils.withNewTab({
|
||||
gBrowser,
|
||||
url: kPage
|
||||
}, function*(aBrowser) {
|
||||
let contextMenu = document.getElementById("contentAreaContextMenu");
|
||||
ok(contextMenu, "Got context menu");
|
||||
|
||||
info("Open context menu");
|
||||
is(contextMenu.state, "closed", "Should not have opened context menu");
|
||||
let popupShownPromise = promiseWaitForEvent(window, "popupshown");
|
||||
EventUtils.synthesizeMouse(aBrowser, window.innerWidth / 3,
|
||||
window.innerHeight / 3,
|
||||
{type: "contextmenu", button: 2}, window);
|
||||
yield popupShownPromise;
|
||||
is(contextMenu.state, "open", "Should have opened context menu");
|
||||
|
||||
let pageMenuSep = document.getElementById("page-menu-separator");
|
||||
ok(pageMenuSep && !pageMenuSep.hidden,
|
||||
"Page menu separator should be shown");
|
||||
|
||||
let testMenuSep = pageMenuSep.previousSibling;
|
||||
ok(testMenuSep && !testMenuSep.hidden,
|
||||
"User-added menu separator should be shown");
|
||||
|
||||
let testMenuItem = testMenuSep.previousSibling;
|
||||
is(testMenuItem.label, "Test Context Menu Click", "Got context menu item");
|
||||
|
||||
let promiseCtxMenuClick = ContentTask.spawn(aBrowser, null, function*() {
|
||||
yield new Promise(resolve => {
|
||||
let Ci = Components.interfaces;
|
||||
let windowUtils = content.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIDOMWindowUtils);
|
||||
let menuitem = content.document.getElementById("menuitem");
|
||||
menuitem.addEventListener("click", function() {
|
||||
Assert.ok(windowUtils.isHandlingUserInput,
|
||||
"Content menu click should be a user input");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
EventUtils.synthesizeMouseAtCenter(testMenuItem, {}, window);
|
||||
yield promiseCtxMenuClick;
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue