Skip to content

Commit

Permalink
chore: add spec
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 committed Jul 1, 2021
1 parent ce96561 commit bc20205
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions spec-main/chromium-spec.ts
Expand Up @@ -1461,6 +1461,31 @@ describe('chromium features', () => {
expect(pageExists).to.be.true();
});
});

describe('document.hasFocus', () => {
it('has correct value when multiple windows are opened', async () => {
const w1 = new BrowserWindow({ show: true });
const w2 = new BrowserWindow({ show: true });
const w3 = new BrowserWindow({ show: false });
await w1.loadFile(path.join(__dirname, 'fixtures', 'blank.html'));
await w2.loadFile(path.join(__dirname, 'fixtures', 'blank.html'));
await w3.loadFile(path.join(__dirname, 'fixtures', 'blank.html'));
expect(webContents.getFocusedWebContents().id).to.equal(w2.webContents.id);
let focus = false;
focus = await w1.webContents.executeJavaScript(
'document.hasFocus()'
);
expect(focus).to.be.false();
focus = await w2.webContents.executeJavaScript(
'document.hasFocus()'
);
expect(focus).to.be.true();
focus = await w3.webContents.executeJavaScript(
'document.hasFocus()'
);
expect(focus).to.be.false();
});
});
});

describe('font fallback', () => {
Expand Down

0 comments on commit bc20205

Please sign in to comment.