fix: crash in window.print() (#19690)
* fix: crash in window.print() * add preliminary tests
This commit is contained in:
parent
ba5ee79af8
commit
e8fa248571
4 changed files with 47 additions and 15 deletions
|
@ -99,6 +99,28 @@ describe('webContents module', () => {
|
|||
})
|
||||
})
|
||||
|
||||
describe('webContents.print()', () => {
|
||||
it('throws when invalid settings are passed', () => {
|
||||
const w = new BrowserWindow({ show: false })
|
||||
expect(() => {
|
||||
// @ts-ignore this line is intentionally incorrect
|
||||
w.webContents.print(true)
|
||||
}).to.throw('webContents.print(): Invalid print settings specified.')
|
||||
|
||||
expect(() => {
|
||||
// @ts-ignore this line is intentionally incorrect
|
||||
w.webContents.print({}, true)
|
||||
}).to.throw('webContents.print(): Invalid optional callback provided.')
|
||||
})
|
||||
|
||||
it('does not crash', () => {
|
||||
const w = new BrowserWindow({ show: false })
|
||||
expect(() => {
|
||||
w.webContents.print({ silent: true })
|
||||
}).to.not.throw()
|
||||
})
|
||||
})
|
||||
|
||||
describe('webContents.executeJavaScript', () => {
|
||||
describe('in about:blank', () => {
|
||||
const expected = 'hello, world!'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue