From 14b65467d860741f8964726844f030c37fd2b45b Mon Sep 17 00:00:00 2001 From: Heilig Benedek Date: Tue, 28 Nov 2017 00:13:07 +0100 Subject: [PATCH] add test for menu closed event --- spec/api-menu-spec.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/api-menu-spec.js b/spec/api-menu-spec.js index 0e1050066855..dc73bf4bd9fb 100644 --- a/spec/api-menu-spec.js +++ b/spec/api-menu-spec.js @@ -325,6 +325,32 @@ describe('Menu module', () => { }) }) + describe('Menu.closePopup()', () => { + let w = null + let menu + + beforeEach(() => { + w = new BrowserWindow({show: false, width: 200, height: 200}) + menu = Menu.buildFromTemplate([ + { + label: '1' + } + ]) + menu.popup(w, {x: 100, y: 100, async: true}) + menu.closePopup(w) + }) + + afterEach(() => { + return closeWindow(w).then(() => { w = null }) + }) + + it('emits closed event', () => { + menu.on('closed', () => { + done() + }) + }) + }) + describe('Menu.setApplicationMenu', () => { it('sets a menu', () => { const menu = Menu.buildFromTemplate([