From ef2a28ca8643a88546f42fb39d4851f7a421f90d Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 30 Mar 2016 11:17:24 -0700 Subject: [PATCH] Listen for browser-window-created event for asserts --- spec/webview-spec.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/spec/webview-spec.js b/spec/webview-spec.js index 3d45d51e6..122c22ad2 100644 --- a/spec/webview-spec.js +++ b/spec/webview-spec.js @@ -4,7 +4,7 @@ const http = require('http') const url = require('url') const {remote} = require('electron') -const {BrowserWindow} = remote +const {app} = remote describe(' tag', function () { this.timeout(10000) @@ -79,14 +79,8 @@ describe(' tag', function () { it('disables node integration on child windows when it is disabled on the webview', function (done) { - webview.addEventListener('console-message', function (e) { - assert.equal(e.message, 'window opened') - const sourceId = remote.getCurrentWindow().id - const windows = BrowserWindow.getAllWindows().filter(function (window) { - return window.id !== sourceId - }) - assert.equal(windows.length, 1) - assert.equal(windows[0].webContents.getWebPreferences().nodeIntegration, false) + app.once('browser-window-created', function (event, window) { + assert.equal(window.webContents.getWebPreferences().nodeIntegration, false) done() }) -- 2.34.1