Make callback work for old-style Menu.popup call
While the old-style Menu.popup has been deprecated, it is still being used widely in apps and even in Electron itself.
This commit is contained in:
Родитель
2ec3b8ce76
Коммит
73d78d345a
|
@ -56,6 +56,11 @@ Menu.prototype.popup = function (window, x, y, positioningItem) {
|
|||
[newPosition, newY, newX, newWindow] = [y, x, window, null]
|
||||
}
|
||||
|
||||
// menu.popup([w], x, y, callback)
|
||||
if (typeof newPosition === 'function') {
|
||||
callback = newPosition
|
||||
}
|
||||
|
||||
// menu.popup({})
|
||||
if (window != null && window.constructor === Object) {
|
||||
opts = window
|
||||
|
|
|
@ -328,6 +328,11 @@ describe('Menu module', () => {
|
|||
menu.popup({}, () => done())
|
||||
menu.closePopup()
|
||||
})
|
||||
|
||||
it('works with old style', (done) => {
|
||||
menu.popup(w, 100, 101, () => done())
|
||||
menu.closePopup()
|
||||
})
|
||||
})
|
||||
|
||||
describe('Menu.closePopup()', () => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче