-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(gatsby-plugin-image): Better propType handling for StaticImage (#…
…28606) (#28628) * fix(gatsby-plugin-image): Better propType handling for StaticImage * Normalise props * Handle tracedSVG not being camel case (cherry picked from commit 52027db) Co-authored-by: Matt Kane <matt@gatsbyjs.com>
- Loading branch information
Showing
5 changed files
with
85 additions
and
1 deletion.
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
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,42 @@ | ||
import { normalizeProps } from "../babel-helpers" | ||
|
||
describe(`static-image babel parser`, () => { | ||
it(`normalises props`, () => { | ||
const input = { | ||
formats: [`webP`, `JPG`, `png`], | ||
placeholder: `DOMINANT_COLOR`, | ||
layout: `FLUID`, | ||
} | ||
expect(normalizeProps(input)).toEqual({ | ||
formats: [`webp`, `jpg`, `png`], | ||
layout: `fluid`, | ||
placeholder: `dominantColor`, | ||
}) | ||
}) | ||
|
||
it(`handles tracedSvg`, () => { | ||
expect( | ||
normalizeProps({ | ||
placeholder: `TRACED_SVG`, | ||
}) | ||
).toEqual({ | ||
placeholder: `tracedSVG`, | ||
}) | ||
|
||
expect( | ||
normalizeProps({ | ||
placeholder: `tracedSVG`, | ||
}) | ||
).toEqual({ | ||
placeholder: `tracedSVG`, | ||
}) | ||
|
||
expect( | ||
normalizeProps({ | ||
placeholder: `tracedSvg`, | ||
}) | ||
).toEqual({ | ||
placeholder: `tracedSVG`, | ||
}) | ||
}) | ||
}) |
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