mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
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:
@@ -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 () => {
|
||||
|
||||
Reference in New Issue
Block a user