-
Notifications
You must be signed in to change notification settings - Fork 26.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix error when
next/future/image
is missing width or height (#38132)
This PR fixes the case when `next/future/image` is missing the width or height props. It also fixes a case when `100%` or `100vh` were incorrectly parsed as `100` pixels.
- Loading branch information
Showing
10 changed files
with
185 additions
and
123 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
12 changes: 12 additions & 0 deletions
12
test/integration/image-future/default/pages/invalid-height.js
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,12 @@ | ||
import React from 'react' | ||
import Image from 'next/future/image' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<p>Invalid height</p> | ||
|
||
<Image src="/test.jpg" width={400} height="50vh" /> | ||
</div> | ||
) | ||
} |
18 changes: 0 additions & 18 deletions
18
test/integration/image-future/default/pages/invalid-width-or-height.js
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
test/integration/image-future/default/pages/invalid-width.js
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,12 @@ | ||
import React from 'react' | ||
import Image from 'next/future/image' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<p>Invalid width</p> | ||
|
||
<Image src="/test.jpg" width="100%" height={300} /> | ||
</div> | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
test/integration/image-future/default/pages/missing-height.js
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,11 @@ | ||
import React from 'react' | ||
import Image from 'next/future/image' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<h1>Missing height</h1> | ||
<Image src="/test.jpg" width="100" /> | ||
</div> | ||
) | ||
} |
11 changes: 11 additions & 0 deletions
11
test/integration/image-future/default/pages/missing-width.js
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,11 @@ | ||
import React from 'react' | ||
import Image from 'next/future/image' | ||
|
||
export default function Page() { | ||
return ( | ||
<div> | ||
<h1>Missing width or height</h1> | ||
<Image src="/test.jpg" height={100} /> | ||
</div> | ||
) | ||
} |
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
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