mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: webContents return type incorrect (#38111)
fix: webContents return type incorrect (#38026) * fix: webContents type incorrect * fix: ci failed * fix: ci failed 2
This commit is contained in:
@@ -497,16 +497,16 @@ describe('webContents module', () => {
|
||||
testFn('returns the focused web contents', async () => {
|
||||
const w = new BrowserWindow({ show: true });
|
||||
await w.loadFile(path.join(__dirname, 'fixtures', 'blank.html'));
|
||||
expect(webContents.getFocusedWebContents().id).to.equal(w.webContents.id);
|
||||
expect(webContents.getFocusedWebContents()?.id).to.equal(w.webContents.id);
|
||||
|
||||
const devToolsOpened = emittedOnce(w.webContents, 'devtools-opened');
|
||||
w.webContents.openDevTools();
|
||||
await devToolsOpened;
|
||||
expect(webContents.getFocusedWebContents().id).to.equal(w.webContents.devToolsWebContents!.id);
|
||||
expect(webContents.getFocusedWebContents()?.id).to.equal(w.webContents.devToolsWebContents!.id);
|
||||
const devToolsClosed = emittedOnce(w.webContents, 'devtools-closed');
|
||||
w.webContents.closeDevTools();
|
||||
await devToolsClosed;
|
||||
expect(webContents.getFocusedWebContents().id).to.equal(w.webContents.id);
|
||||
expect(webContents.getFocusedWebContents()?.id).to.equal(w.webContents.id);
|
||||
});
|
||||
|
||||
it('does not crash when called on a detached dev tools window', async () => {
|
||||
|
||||
@@ -1954,7 +1954,7 @@ describe('chromium features', () => {
|
||||
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);
|
||||
expect(webContents.getFocusedWebContents()?.id).to.equal(w2.webContents.id);
|
||||
let focus = false;
|
||||
focus = await w1.webContents.executeJavaScript(
|
||||
'document.hasFocus()'
|
||||
|
||||
Reference in New Issue
Block a user