Skip to content

Commit

Permalink
Add layout fill sizing integration test case for px values
Browse files Browse the repository at this point in the history
  • Loading branch information
atcastle committed Jan 29, 2021
1 parent 130c8fb commit 3317dbb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/integration/image-component/default/pages/layout-fill.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@ const Page = () => {
100vw"
/>
</div>
<p>Layout Fill</p>
<div style={{ position: 'relative', width: '50vw', height: '50vh' }}>
<Image
id="fill4"
src="/wide.png"
layout="fill"
objectFit="cover"
objectPosition="left center"
sizes="500px"
/>
</div>
</div>
)
}
Expand Down
3 changes: 3 additions & 0 deletions test/integration/image-component/default/test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,9 @@ function runTests(mode) {
expect(await browser.elementById('fill3').getAttribute('srcset')).toBe(
'/_next/image?url=%2Fwide.png&w=256&q=75 256w, /_next/image?url=%2Fwide.png&w=384&q=75 384w, /_next/image?url=%2Fwide.png&w=640&q=75 640w, /_next/image?url=%2Fwide.png&w=750&q=75 750w, /_next/image?url=%2Fwide.png&w=828&q=75 828w, /_next/image?url=%2Fwide.png&w=1080&q=75 1080w, /_next/image?url=%2Fwide.png&w=1200&q=75 1200w, /_next/image?url=%2Fwide.png&w=1920&q=75 1920w, /_next/image?url=%2Fwide.png&w=2048&q=75 2048w, /_next/image?url=%2Fwide.png&w=3840&q=75 3840w'
)
expect(await browser.elementById('fill4').getAttribute('srcset')).toBe(
'/_next/image?url=%2Fwide.png&amp;w=16&amp;q=75 16w, /_next/image?url=%2Fwide.png&amp;w=32&amp;q=75 32w, /_next/image?url=%2Fwide.png&amp;w=48&amp;q=75 48w, /_next/image?url=%2Fwide.png&amp;w=64&amp;q=75 64w, /_next/image?url=%2Fwide.png&amp;w=96&amp;q=75 96w, /_next/image?url=%2Fwide.png&amp;w=128&amp;q=75 128w, /_next/image?url=%2Fwide.png&amp;w=256&amp;q=75 256w, /_next/image?url=%2Fwide.png&amp;w=384&amp;q=75 384w, /_next/image?url=%2Fwide.png&amp;w=640&amp;q=75 640w, /_next/image?url=%2Fwide.png&amp;w=750&amp;q=75 750w, /_next/image?url=%2Fwide.png&amp;w=828&amp;q=75 828w, /_next/image?url=%2Fwide.png&amp;w=1080&amp;q=75 1080w, /_next/image?url=%2Fwide.png&amp;w=1200&amp;q=75 1200w, /_next/image?url=%2Fwide.png&amp;w=1920&amp;q=75 1920w, /_next/image?url=%2Fwide.png&amp;w=2048&amp;q=75 2048w, /_next/image?url=%2Fwide.png&amp;w=3840&amp;q=75 3840w'
)
expect(await browser.elementById(id).getAttribute('sizes')).toBe('100vw')
expect(await getComputed(browser, id, 'width')).toBe(width)
expect(await getComputed(browser, id, 'height')).toBe(height)
Expand Down

0 comments on commit 3317dbb

Please sign in to comment.