Add spec for detached window crash

This commit is contained in:
Kevin Sawicki 2016-08-23 10:06:05 -07:00
Родитель dd5ee28b2f
Коммит 399470e281
1 изменённых файлов: 23 добавлений и 4 удалений

Просмотреть файл

@ -49,11 +49,9 @@ describe('webContents module', function () {
})
describe('getFocusedWebContents() API', function () {
if (isCi) {
return
}
it('returns the focused web contents', function (done) {
if (isCi) return done()
const specWebContents = remote.getCurrentWebContents()
assert.equal(specWebContents.getId(), webContents.getFocusedWebContents().getId())
@ -69,6 +67,27 @@ describe('webContents module', function () {
specWebContents.openDevTools()
})
it('does not crash when called on a detached dev tools window', function (done) {
const specWebContents = w.webContents
specWebContents.once('devtools-opened', function () {
assert.doesNotThrow(function () {
webContents.getFocusedWebContents()
})
specWebContents.closeDevTools()
})
specWebContents.once('devtools-closed', function () {
assert.doesNotThrow(function () {
webContents.getFocusedWebContents()
})
done()
})
specWebContents.openDevTools({mode: 'detach'})
w.inspectElement(100, 100)
})
})
describe('isFocused() API', function () {