From 5bdf97e7ae91e189995fed63bef52bf5de6142df Mon Sep 17 00:00:00 2001 From: Jeremy Apthorp Date: Thu, 21 May 2020 08:46:17 -0700 Subject: [PATCH] test: hide child windows in webview spec (#23682) --- spec-main/webview-spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/spec-main/webview-spec.ts b/spec-main/webview-spec.ts index 66a4cd6eae..1a8f133b74 100644 --- a/spec-main/webview-spec.ts +++ b/spec-main/webview-spec.ts @@ -32,6 +32,20 @@ describe(' tag', function () { afterEach(closeAllWindows); + function hideChildWindows (e: any, wc: WebContents) { + wc.on('new-window', (event, url, frameName, disposition, options) => { + options.show = false; + }); + } + + before(() => { + app.on('web-contents-created', hideChildWindows); + }); + + after(() => { + app.off('web-contents-created', hideChildWindows); + }); + it('works without script tag in page', async () => { const w = new BrowserWindow({ show: false,