mirror of
https://github.com/electron/electron.git
synced 2026-01-28 00:38:35 -05:00
🔧 Feedback
This commit is contained in:
@@ -48,12 +48,12 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
|
||||
let opts
|
||||
|
||||
// menu.popup(x, y, positioningItem)
|
||||
if (window && typeof window !== 'object' || window.constructor !== BrowserWindow) {
|
||||
if (window != null && !(window instanceof BrowserWindow)) {
|
||||
[newPosition, newY, newX, newWindow] = [y, x, window, null]
|
||||
}
|
||||
|
||||
// menu.popup({})
|
||||
if (typeof window === 'object' && window.constructor !== BrowserWindow) {
|
||||
if (window && window.constructor !== BrowserWindow) {
|
||||
opts = window
|
||||
// menu.popup(window, {})
|
||||
} else if (x && typeof x === 'object') {
|
||||
|
||||
@@ -312,6 +312,16 @@ describe('Menu module', () => {
|
||||
menu.closePopup()
|
||||
})
|
||||
|
||||
it('works without a given BrowserWindow and 0 options', () => {
|
||||
const { browserWindow, x, y } = menu.popup(0, 1)
|
||||
|
||||
assert.equal(browserWindow.constructor.name, 'BrowserWindow')
|
||||
assert.equal(x, 0)
|
||||
assert.equal(y, 1)
|
||||
|
||||
menu.closePopup()
|
||||
})
|
||||
|
||||
it('works with a given BrowserWindow and no options', () => {
|
||||
const { browserWindow, x, y } = menu.popup(w, 100, 101)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user