Add spec for closing from will-navigate listener

This commit is contained in:
Kevin Sawicki 2016-12-21 10:00:27 -08:00
parent 1308f790ad
commit abea1196de
2 changed files with 19 additions and 0 deletions

View file

@ -221,3 +221,12 @@ ipcMain.on('set-client-certificate-option', function (event, skip) {
})
event.returnValue = 'done'
})
ipcMain.on('close-on-will-navigate', (event, id) => {
const contents = event.sender
const window = BrowserWindow.fromId(id)
window.webContents.once('will-navigate', (event, input) => {
window.close()
contents.send('closed-on-will-navigate')
})
})