From 9a277f785d8088c430ad2a293a33e802bdbc9c76 Mon Sep 17 00:00:00 2001 From: John Kleinschmidt Date: Thu, 19 May 2022 10:36:37 -0400 Subject: [PATCH] test: fixup BrowserWindow.setTitlebarOverlay test --- spec-main/api-browser-window-spec.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/spec-main/api-browser-window-spec.ts b/spec-main/api-browser-window-spec.ts index 4d348bb924c47..cc885f93d607b 100644 --- a/spec-main/api-browser-window-spec.ts +++ b/spec-main/api-browser-window-spec.ts @@ -2187,8 +2187,10 @@ describe('BrowserWindow module', () => { const [, newOverlayRect] = await geometryChange; expect(newOverlayRect.width).to.equal(overlayRect.width + 400); }; - afterEach(closeAllWindows); - afterEach(() => { ipcMain.removeAllListeners('geometrychange'); }); + afterEach(async () => { + await closeAllWindows(); + ipcMain.removeAllListeners('geometrychange'); + }); it('creates browser window with hidden title bar', () => { const w = new BrowserWindow({ show: false, @@ -2266,16 +2268,20 @@ describe('BrowserWindow module', () => { // Confirm that maximization only affected the height of the buttons and not the title bar expect(overlayRectPostMax.height).to.equal(size); }; - afterEach(closeAllWindows); - afterEach(() => { ipcMain.removeAllListeners('geometrychange'); }); + afterEach(async () => { + await closeAllWindows(); + ipcMain.removeAllListeners('geometrychange'); + }); it('sets Window Control Overlay with title bar height of 40', async () => { await testWindowsOverlayHeight(40); }); }); ifdescribe(process.platform === 'win32')('BrowserWindow.setTitlebarOverlay', () => { - afterEach(closeAllWindows); - afterEach(() => { ipcMain.removeAllListeners('geometrychange'); }); + afterEach(async () => { + await closeAllWindows(); + ipcMain.removeAllListeners('geometrychange'); + }); it('does not crash when an invalid titleBarStyle was initially set', () => { const win = new BrowserWindow({