Skip to content

Commit f701618

Browse files
authored
tests: do not check expectations inside IPC handlers (electron#24310)
Co-authored-by: Milan Burda <miburda@microsoft.com>
1 parent 7367495 commit f701618

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

spec-main/api-web-contents-spec.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -761,15 +761,15 @@ describe('webContents module', () => {
761761
describe('focus()', () => {
762762
describe('when the web contents is hidden', () => {
763763
afterEach(closeAllWindows)
764-
it('does not blur the focused window', (done) => {
764+
it('does not blur the focused window', async () => {
765765
const w = new BrowserWindow({ show: false, webPreferences: { nodeIntegration: true } })
766-
ipcMain.once('answer', (event, parentFocused, childFocused) => {
767-
expect(parentFocused).to.be.true()
768-
expect(childFocused).to.be.false()
769-
done()
770-
})
766+
const answer = emittedOnce(ipcMain, 'answer')
771767
w.show()
772768
w.loadFile(path.join(fixturesPath, 'pages', 'focus-web-contents.html'))
769+
770+
const [, parentFocused, childFocused] = await answer
771+
expect(parentFocused).to.be.true()
772+
expect(childFocused).to.be.false()
773773
})
774774
})
775775
})

0 commit comments

Comments
 (0)