Skip to content

Commit

Permalink
test: confirm that webcontents focus event is fired on browserwindow …
Browse files Browse the repository at this point in the history
…focus
  • Loading branch information
samuelmaddock committed Oct 21, 2020
1 parent 40e832f commit 89ad21d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions spec-main/api-web-contents-spec.ts
Expand Up @@ -798,6 +798,27 @@ describe('webContents module', () => {
w.webContents.focus();
await expect(focusPromise).to.eventually.be.fulfilled();
});

it('is triggered when BrowserWindow is focused', async () => {
const window1 = new BrowserWindow({ show: false });
const window2 = new BrowserWindow({ show: false });

await Promise.all([
window1.loadURL('about:blank'),
window2.loadURL('about:blank')
]);

window1.show();
window2.show();

let focusPromise = emittedOnce(window1.webContents, 'focus');
window1.focus();
await expect(focusPromise).to.eventually.be.fulfilled();

focusPromise = emittedOnce(window2.webContents, 'focus');
window2.focus();
await expect(focusPromise).to.eventually.be.fulfilled();
});
});

describe('blur event', () => {
Expand Down

0 comments on commit 89ad21d

Please sign in to comment.