diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/html/test/browser_content_contextmenu_userinput.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/html/test/browser_content_contextmenu_userinput.js')
-rw-r--r-- | dom/html/test/browser_content_contextmenu_userinput.js | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/dom/html/test/browser_content_contextmenu_userinput.js b/dom/html/test/browser_content_contextmenu_userinput.js new file mode 100644 index 000000000..7d0387715 --- /dev/null +++ b/dom/html/test/browser_content_contextmenu_userinput.js @@ -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; + }); +}); |