Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix type errors in devToolsWebContents #23187

Merged
merged 1 commit into from
Apr 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 6 additions & 6 deletions spec-main/api-web-contents-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ describe('webContents module', () => {
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;
Expand Down Expand Up @@ -468,7 +468,7 @@ describe('webContents module', () => {
const w = new BrowserWindow({ show: false });
w.webContents.openDevTools();
w.webContents.once('devtools-opened', () => {
expect(w.webContents.devToolsWebContents.getWebPreferences()).to.be.null();
expect(w.webContents.devToolsWebContents!.getWebPreferences()).to.be.null();
done();
});
});
Expand Down Expand Up @@ -1656,11 +1656,11 @@ describe('webContents module', () => {
const opened = emittedOnce(w.webContents, 'devtools-opened');
w.webContents.openDevTools();
await opened;
await emittedOnce(w.webContents.devToolsWebContents, 'did-finish-load');
w.webContents.devToolsWebContents.focus();
await emittedOnce(w.webContents.devToolsWebContents!, 'did-finish-load');
w.webContents.devToolsWebContents!.focus();

// Focus an input field
await w.webContents.devToolsWebContents.executeJavaScript(`
await w.webContents.devToolsWebContents!.executeJavaScript(`
const input = document.createElement('input')
document.body.innerHTML = ''
document.body.appendChild(input)
Expand All @@ -1670,7 +1670,7 @@ describe('webContents module', () => {
// Write something to the clipboard
clipboard.writeText('test value');

const pasted = w.webContents.devToolsWebContents.executeJavaScript(`new Promise(resolve => {
const pasted = w.webContents.devToolsWebContents!.executeJavaScript(`new Promise(resolve => {
document.querySelector('input').addEventListener('paste', (e) => {
resolve(e.target.value)
})
Expand Down