Skip to content

Commit

Permalink
fix(gatsby-remark-images): allow strings for the wrapperStyle option (#…
Browse files Browse the repository at this point in the history
…27912) (#27919)

(cherry picked from commit d64603e)
  • Loading branch information
vladar authored Nov 9, 2020
1 parent 4725e8b commit 05b8838
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions packages/gatsby-remark-images/src/__tests__/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe(`pluginOptionsSchema`, () => {
`"showCaptions" must be a boolean`,
`"markdownCaptions" must be a boolean`,
`"sizeByPixelDensity" must be a boolean`,
`"wrapperStyle" must be one of [object]`,
`"wrapperStyle" must be one of [object, string]`,
`"backgroundColor" must be a string`,
`"quality" must be a number`,
`"withWebp" must be a boolean`,
Expand All @@ -26,7 +26,7 @@ describe(`pluginOptionsSchema`, () => {
showCaptions: `This should be a boolean`,
markdownCaptions: `This should be a boolean`,
sizeByPixelDensity: `This should be a boolean`,
wrapperStyle: `This should be an object`,
wrapperStyle: true,
backgroundColor: 123,
quality: `This should be a number`,
withWebp: `This should be a boolean`,
Expand Down
3 changes: 2 additions & 1 deletion packages/gatsby-remark-images/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ exports.pluginOptionsSchema = function ({ Joi }) {
),
wrapperStyle: Joi.alternatives().try(
Joi.object({}).unknown(true),
Joi.function().maxArity(1)
Joi.function().maxArity(1),
Joi.string()
),
backgroundColor: Joi.string().default(`white`)
.description(`Set the background color of the image to match the background image of your design.
Expand Down

0 comments on commit 05b8838

Please sign in to comment.