From cb9c2233879b33d21d3c1e958df9e3d95a694ecf Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Sat, 16 Jan 2021 22:07:30 +0000 Subject: [PATCH] fix: correctly generate url params for sanity images closes #63 --- src/sanity-image.ts | 2 +- test/unit/__snapshots__/sanity-image.test.ts.snap | 2 +- test/unit/sanity-image.test.ts | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sanity-image.ts b/src/sanity-image.ts index a004df3e..b0ae089c 100644 --- a/src/sanity-image.ts +++ b/src/sanity-image.ts @@ -204,7 +204,7 @@ export const SanityImage = extendVue({ const queryParams = keys .map((prop) => { - const urlFormat = prop.replace(/[A-Z]./, r => '-' + r[1].toLowerCase()) + const urlFormat = prop.replace(/[A-Z]/, r => '-' + r.toLowerCase()) return props[prop] ? `${urlFormat}=${props[prop]}` : undefined }) .filter(Boolean) diff --git a/test/unit/__snapshots__/sanity-image.test.ts.snap b/test/unit/__snapshots__/sanity-image.test.ts.snap index 0fdf404f..72479a45 100644 --- a/test/unit/__snapshots__/sanity-image.test.ts.snap +++ b/test/unit/__snapshots__/sanity-image.test.ts.snap @@ -1,3 +1,3 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`SanityImage provides a valid renderless component 1`] = ``; +exports[`SanityImage provides a valid renderless component 1`] = ``; diff --git a/test/unit/sanity-image.test.ts b/test/unit/sanity-image.test.ts index bb60b371..087cab58 100644 --- a/test/unit/sanity-image.test.ts +++ b/test/unit/sanity-image.test.ts @@ -41,6 +41,7 @@ describe('SanityImage', () => {