diff --git a/src/createPrismic.ts b/src/createPrismic.ts index a8d670e..9107fee 100644 --- a/src/createPrismic.ts +++ b/src/createPrismic.ts @@ -91,7 +91,7 @@ export const createPrismic = (options: PrismicPluginOptions): PrismicPlugin => { : { linkResolver: options.linkResolver, serializer: options.richTextSerializer || options.htmlSerializer, - ...config, + ...configOrLinkResolver, }, ); }, diff --git a/test/createPrismic-helpers.test.ts b/test/createPrismic-helpers.test.ts index 82502c7..7cb8281 100644 --- a/test/createPrismic-helpers.test.ts +++ b/test/createPrismic-helpers.test.ts @@ -88,7 +88,31 @@ it("`asHTML` uses provided default deprecated serializer", () => { expect(spiedRichTextSerializer).toHaveBeenCalled(); }); -it("`asHTML` uses provided HTML serializer over default provided", () => { +it("`asHTML` uses provided serializer over default provided", () => { + const spiedRichTextSerializer1 = vi.fn(); + const spiedRichTextSerializer2 = vi.fn(); + + const prismic = createPrismic({ + endpoint: "test", + richTextSerializer: spiedRichTextSerializer1, + }); + + const wrapper = mount(WrapperComponent, { + global: { + plugins: [prismic], + }, + }); + + wrapper.vm.$prismic.asHTML(richTextFixture.en, { + serializer: spiedRichTextSerializer2, + }); + + expect(spiedRichTextSerializer1).not.toHaveBeenCalled(); + expect(spiedRichTextSerializer2).toHaveBeenCalled(); +}); + +// TODO: Remove in v5 +it("`asHTML` uses provided deprecated serializer over default provided", () => { const spiedRichTextSerializer1 = vi.fn(); const spiedRichTextSerializer2 = vi.fn();