fix: webContents.print parameter validation error (#38721)

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
trop[bot]
2023-06-11 09:56:35 +02:00
committed by GitHub
parent 29d776400a
commit 0b181e7977
3 changed files with 29 additions and 7 deletions

View File

@@ -194,6 +194,14 @@ describe('webContents module', () => {
}).to.throw('webContents.print(): Invalid print settings specified.');
});
it('throws when an invalid pageSize is passed', () => {
const badSize = 5;
expect(() => {
// @ts-ignore this line is intentionally incorrect
w.webContents.print({ pageSize: badSize });
}).to.throw(`Unsupported pageSize: ${badSize}`);
});
it('throws when an invalid callback is passed', () => {
expect(() => {
// @ts-ignore this line is intentionally incorrect