mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: webContents.print options should be optional (#41479)
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:
@@ -187,11 +187,32 @@ describe('webContents module', () => {
|
||||
|
||||
afterEach(closeAllWindows);
|
||||
|
||||
it('does not throw when options are not passed', () => {
|
||||
expect(() => {
|
||||
w.webContents.print();
|
||||
}).not.to.throw();
|
||||
|
||||
expect(() => {
|
||||
w.webContents.print(undefined);
|
||||
}).not.to.throw();
|
||||
});
|
||||
|
||||
it('does not throw when options object is empty', () => {
|
||||
expect(() => {
|
||||
w.webContents.print({});
|
||||
}).not.to.throw();
|
||||
});
|
||||
|
||||
it('throws when invalid settings are passed', () => {
|
||||
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(null);
|
||||
}).to.throw('webContents.print(): Invalid print settings specified.');
|
||||
});
|
||||
|
||||
it('throws when an invalid pageSize is passed', () => {
|
||||
|
||||
Reference in New Issue
Block a user