test: convert functions to async & eliminate duplicates (#37316)
test: convert functions to async Co-authored-by: Milan Burda <miburda@microsoft.com>
This commit is contained in:
parent
969665eaa2
commit
f97d68c4bf
24 changed files with 225 additions and 343 deletions
|
@ -176,17 +176,16 @@ describe('webContents.setWindowOpenHandler', () => {
|
|||
await emittedOnce(browserWindow.webContents, 'did-create-window');
|
||||
});
|
||||
|
||||
it('can change webPreferences of child windows', (done) => {
|
||||
it('can change webPreferences of child windows', async () => {
|
||||
browserWindow.webContents.setWindowOpenHandler(() => ({ action: 'allow', overrideBrowserWindowOptions: { webPreferences: { defaultFontSize: 30 } } }));
|
||||
|
||||
browserWindow.webContents.on('did-create-window', async (childWindow) => {
|
||||
await childWindow.webContents.executeJavaScript("document.write('hello')");
|
||||
const size = await childWindow.webContents.executeJavaScript("getComputedStyle(document.querySelector('body')).fontSize");
|
||||
expect(size).to.equal('30px');
|
||||
done();
|
||||
});
|
||||
|
||||
const didCreateWindow = emittedOnce(browserWindow.webContents, 'did-create-window');
|
||||
browserWindow.webContents.executeJavaScript("window.open('about:blank', '', 'show=no') && true");
|
||||
const [childWindow] = await didCreateWindow;
|
||||
|
||||
await childWindow.webContents.executeJavaScript("document.write('hello')");
|
||||
const size = await childWindow.webContents.executeJavaScript("getComputedStyle(document.querySelector('body')).fontSize");
|
||||
expect(size).to.equal('30px');
|
||||
});
|
||||
|
||||
it('does not hang parent window when denying window.open', async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue