feat: add activate option to webContents.openDevTools (#13852)

This commit is contained in:
Milan Burda 2018-11-27 10:34:44 +01:00 committed by Cheng Zhao
parent aafbd865bf
commit d63a848011
13 changed files with 63 additions and 32 deletions

View file

@ -159,6 +159,22 @@ describe('webContents module', () => {
})
})
describe('openDevTools() API', () => {
it('can show window with activation', async () => {
w.show()
assert.strictEqual(w.isFocused(), true)
w.webContents.openDevTools({ mode: 'detach', activate: true })
await emittedOnce(w.webContents, 'devtools-opened')
assert.strictEqual(w.isFocused(), false)
})
it('can show window without activation', async () => {
w.webContents.openDevTools({ mode: 'detach', activate: false })
await emittedOnce(w.webContents, 'devtools-opened')
assert.strictEqual(w.isDevToolsOpened(), true)
})
})
describe('before-input-event event', () => {
it('can prevent document keyboard events', (done) => {
ipcMain.once('keydown', (event, key) => {