Unverified Commit 13a5eb22 authored by Alex Castle's avatar Alex Castle Committed by GitHub

Add position styling to future fill images (#39438)

This PR adds default style properties to a fill-mode image using `next/future/image` of 0 for all positions. This should replicate the existing `layout="fill"` behavior better, and make it easier to migrate.

Tests are also added for fill styling.
parent a9b415b8
......@@ -576,6 +576,10 @@ export default function Image({
position: 'absolute',
height: '100%',
width: '100%',
left: 0,
top: 0,
right: 0,
bottom: 0,
}
: {},
showAltText || placeholder === 'blur' ? {} : { color: 'transparent' },
......
......@@ -992,6 +992,15 @@ function runTests(mode) {
)
).toBe('100%')
})
it('should add position styles to fill images', async () => {
expect(
await browser.eval(
`document.getElementById("fill-image-1").getAttribute('style')`
)
).toBe(
'position:absolute;height:100%;width:100%;left:0;top:0;right:0;bottom:0;color:transparent'
)
})
if (mode === 'dev') {
it('should not log incorrect warnings', async () => {
await waitFor(1000)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment