mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: validate printToPDF margins against pageSize (#41266)
fix: validate `printToPDF` `margins` against `pageSize` (#41157) fix: validate margins against pageSize
This commit is contained in:
@@ -2048,6 +2048,20 @@ describe('webContents module', () => {
|
||||
}
|
||||
});
|
||||
|
||||
it('rejects when margins exceed physical page size', async () => {
|
||||
await w.loadURL('data:text/html,<h1>Hello, World!</h1>');
|
||||
|
||||
await expect(w.webContents.printToPDF({
|
||||
pageSize: 'Letter',
|
||||
margins: {
|
||||
top: 100,
|
||||
bottom: 100,
|
||||
left: 5,
|
||||
right: 5
|
||||
}
|
||||
})).to.eventually.be.rejectedWith('margins must be less than or equal to pageSize');
|
||||
});
|
||||
|
||||
it('does not crash when called multiple times in parallel', async () => {
|
||||
await w.loadURL('data:text/html,<h1>Hello, World!</h1>');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user