tests: do not check expectations inside IPC handlers (#24310)

Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
Milan Burda
2020-06-26 22:15:48 +02:00
committed by GitHub
parent 736749522b
commit f70161856c

View File

@@ -761,15 +761,15 @@ describe('webContents module', () => {
describe('focus()', () => {
describe('when the web contents is hidden', () => {
afterEach(closeAllWindows)
it('does not blur the focused window', (done) => {
it('does not blur the focused window', async () => {
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
ipcMain.once('answer', (event, parentFocused, childFocused) => {
expect(parentFocused).to.be.true()
expect(childFocused).to.be.false()
done()
})
const answer = emittedOnce(ipcMain, 'answer')
w.show()
w.loadFile(path.join(fixturesPath, 'pages', 'focus-web-contents.html'))
const [, parentFocused, childFocused] = await answer
expect(parentFocused).to.be.true()
expect(childFocused).to.be.false()
})
})
})