Explicitly close popup window
This commit is contained in:
parent
e16fa08e61
commit
766f5afabd
1 changed files with 8 additions and 1 deletions
|
@ -698,6 +698,7 @@ describe('browser-window module', function () {
|
||||||
})
|
})
|
||||||
let htmlPath = path.join(fixtures, 'api', 'sandbox.html?window-open-external')
|
let htmlPath = path.join(fixtures, 'api', 'sandbox.html?window-open-external')
|
||||||
const pageUrl = 'file://' + htmlPath
|
const pageUrl = 'file://' + htmlPath
|
||||||
|
let openedWindow
|
||||||
w.loadURL(pageUrl)
|
w.loadURL(pageUrl)
|
||||||
w.webContents.once('new-window', (e, url, frameName, disposition, options) => {
|
w.webContents.once('new-window', (e, url, frameName, disposition, options) => {
|
||||||
assert.equal(url, 'http://www.google.com/#q=electron')
|
assert.equal(url, 'http://www.google.com/#q=electron')
|
||||||
|
@ -710,11 +711,17 @@ describe('browser-window module', function () {
|
||||||
assert.equal(html, '<h1>http://www.google.com/#q=electron</h1>')
|
assert.equal(html, '<h1>http://www.google.com/#q=electron</h1>')
|
||||||
ipcMain.once('answer', function (event, exceptionMessage) {
|
ipcMain.once('answer', function (event, exceptionMessage) {
|
||||||
assert(/Blocked a frame with origin/.test(exceptionMessage))
|
assert(/Blocked a frame with origin/.test(exceptionMessage))
|
||||||
done()
|
|
||||||
|
// FIXME this opened window should be closed in sandbox.html
|
||||||
|
closeWindow(openedWindow).then(done)
|
||||||
})
|
})
|
||||||
w.webContents.send('child-loaded')
|
w.webContents.send('child-loaded')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.once('browser-window-created', function (event, window) {
|
||||||
|
openedWindow = window
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should set ipc event sender correctly', function (done) {
|
it('should set ipc event sender correctly', function (done) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue