From ef01c16c6ae38fed96e4745b7ca9741979631816 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Tue, 23 May 2017 14:31:20 -0700 Subject: [PATCH] Add tests for more nativeWindowOpen events --- spec/webview-spec.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index e9f2cd9fb688..3d517f0e7daa 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -1685,5 +1685,24 @@ describe(' tag', function () { webview.src = 'file://' + fixtures + '/pages/window-open.html' document.body.appendChild(webview) }) + + it('emits a browser-window-created event', (done) => { + app.once('browser-window-created', () => { + done() + }) + webview.src = 'file://' + fixtures + '/pages/window-open.html' + document.body.appendChild(webview) + }) + + it('emits a web-contents-created event', (done) => { + app.on('web-contents-created', function listener (event, contents) { + if (contents.getType() === 'window') { + app.removeListener('web-contents-created', listener) + done() + } + }) + webview.src = 'file://' + fixtures + '/pages/window-open.html' + document.body.appendChild(webview) + }) }) })