-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(testing): use viewport for Puppeteer screenshot clip dimensions (#…
…5359) * fix(testing): use viewport for Puppeteer screenshot clip dimensions Fixes #5353 STENCIL-1135 * export options function and test * pr feedback
- Loading branch information
1 parent
7a70281
commit c879800
Showing
2 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { createPuppeteerScreenshotOptions } from '../puppeteer-screenshot'; | ||
|
||
describe('Puppeteer Screenshot', () => { | ||
describe('createPuppeteerScreenshotOptions', () => { | ||
it('should use the viewport width and height by default', () => { | ||
const options = createPuppeteerScreenshotOptions({}, { width: 800, height: 600 }); | ||
|
||
expect(options.clip).toEqual({ | ||
x: 0, | ||
y: 0, | ||
width: 800, | ||
height: 600, | ||
}); | ||
}); | ||
|
||
it('should use clip options if provided', () => { | ||
const options = createPuppeteerScreenshotOptions( | ||
{ | ||
clip: { | ||
x: 10, | ||
y: 20, | ||
width: 100, | ||
height: 200, | ||
}, | ||
}, | ||
{ width: 800, height: 600 }, | ||
); | ||
|
||
expect(options.clip).toEqual({ | ||
x: 10, | ||
y: 20, | ||
width: 100, | ||
height: 200, | ||
}); | ||
}); | ||
}); | ||
}); |