Merge pull request #11961 from electron/fix-bw-callback
add conditional for menu.popup(window, callback)
This commit is contained in:
commit
459a5e3a1f
2 changed files with 8 additions and 2 deletions
|
@ -58,8 +58,9 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
|
|||
callback = newPosition
|
||||
}
|
||||
|
||||
// menu.popup({})
|
||||
if (window != null && window.constructor === Object) {
|
||||
// menu.popup({}) || menu.popup(window, callback)
|
||||
if ((window != null && window.constructor === Object) ||
|
||||
(x && typeof x === 'function')) {
|
||||
opts = window
|
||||
callback = arguments[1]
|
||||
// menu.popup(window, {})
|
||||
|
|
|
@ -383,6 +383,11 @@ describe('Menu module', () => {
|
|||
assert.equal(y, 101)
|
||||
})
|
||||
|
||||
it('works with a given BrowserWindow, no options, and a callback', (done) => {
|
||||
menu.popup(w, () => done())
|
||||
menu.closePopup()
|
||||
})
|
||||
|
||||
it('calls the callback', (done) => {
|
||||
menu.popup({}, () => done())
|
||||
menu.closePopup()
|
||||
|
|
Loading…
Reference in a new issue