diff --git a/packages/babel-preset/src/index.test.ts b/packages/babel-preset/src/index.test.ts index bf09b86d..8460c9fe 100644 --- a/packages/babel-preset/src/index.test.ts +++ b/packages/babel-preset/src/index.test.ts @@ -132,6 +132,26 @@ describe('preset', () => { `) }) + it('handles descProp and titleProp', () => { + expect( + testPreset('', { + titleProp: true, + descProp: true, + }), + ).toMatchInlineSnapshot(` + "import * as React from \\"react\\"; + + const SvgComponent = ({ + title, + titleId, + desc, + descId + }) => {desc ? {desc} : null}{title ? {title} : null}; + + export default SvgComponent;" + `) + }) + it('handles replaceAttrValues', () => { expect( testPreset('', { diff --git a/packages/babel-preset/src/index.ts b/packages/babel-preset/src/index.ts index aa8faf58..c77b2396 100644 --- a/packages/babel-preset/src/index.ts +++ b/packages/babel-preset/src/index.ts @@ -143,7 +143,7 @@ const plugin = (_: ConfigAPI, opts: Options) => { } if (opts.descProp) { - plugins.push([svgDynamicTitle, { tag: 'desc' }]) + plugins.push([svgDynamicTitle, { tag: 'desc' }, 'desc']) } if (opts.native) {