fix: update shell.openExternal to correctly focus on external window (#44408)
* fix: Use openURL:configuration:completionHandler instead of openUrl * test: add a test * fix: add dispatch_async to replace GetUIThreadTaskRunner * refactor: remove unused import * fix: update to use BindPostTaskToCurrentDefault * test: add regression test for window focus * refactor: update to explicit task runner
This commit is contained in:
parent
7ff7160135
commit
de04fc3b90
2 changed files with 36 additions and 4 deletions
|
@ -76,6 +76,21 @@ describe('shell module', () => {
|
|||
requestReceived
|
||||
]);
|
||||
});
|
||||
|
||||
ifit(process.platform === 'darwin')('removes focus from the electron window after opening an external link', async () => {
|
||||
const url = 'http://127.0.0.1';
|
||||
const w = new BrowserWindow({ show: true });
|
||||
|
||||
await once(w, 'focus');
|
||||
expect(w.isFocused()).to.be.true();
|
||||
|
||||
await Promise.all<void>([
|
||||
shell.openExternal(url),
|
||||
once(w, 'blur') as Promise<any>
|
||||
]);
|
||||
|
||||
expect(w.isFocused()).to.be.false();
|
||||
});
|
||||
});
|
||||
|
||||
describe('shell.trashItem()', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue