Update api-browser-window-spec.js

This commit is contained in:
xaviergonz 2017-05-02 20:14:52 +02:00 committed by Cheng Zhao
parent e18cdc185a
commit 0301961c25

View file

@ -1273,8 +1273,12 @@ describe('BrowserWindow module', function () {
const initialWebContents = webContents.getAllWebContents().map((i) => i.id)
ipcRenderer.send('prevent-next-new-window', w.webContents.id)
w.webContents.once('new-window', () => {
assert.deepEqual(webContents.getAllWebContents().map((i) => i.id), initialWebContents)
done()
// We need to give it some time so the windows get properly disposed (at least on OSX).
setTimeout(() => {
const currentWebContents = webContents.getAllWebContents().map((i) => i.id)
assert.deepEqual(currentWebContents, initialWebContents)
done()
}, 100);
})
w.loadURL('file://' + path.join(fixtures, 'pages', 'window-open.html'))
})