File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
packages/babel-preset/src Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,26 @@ describe('preset', () => {
132132 ` )
133133 } )
134134
135+ it ( 'handles descProp and titleProp' , ( ) => {
136+ expect (
137+ testPreset ( '<svg></svg>' , {
138+ titleProp : true ,
139+ descProp : true ,
140+ } ) ,
141+ ) . toMatchInlineSnapshot ( `
142+ "import * as React from \\"react\\";
143+
144+ const SvgComponent = ({
145+ title,
146+ titleId,
147+ desc,
148+ descId
149+ }) => <svg aria-labelledby={titleId} aria-describedby={descId}>{desc ? <desc id={descId}>{desc}</desc> : null}{title ? <title id={titleId}>{title}</title> : null}</svg>;
150+
151+ export default SvgComponent;"
152+ ` )
153+ } )
154+
135155 it ( 'handles replaceAttrValues' , ( ) => {
136156 expect (
137157 testPreset ( '<svg a="#000" b="#fff" />' , {
Original file line number Diff line number Diff line change @@ -143,7 +143,7 @@ const plugin = (_: ConfigAPI, opts: Options) => {
143143 }
144144
145145 if ( opts . descProp ) {
146- plugins . push ( [ svgDynamicTitle , { tag : 'desc' } ] )
146+ plugins . push ( [ svgDynamicTitle , { tag : 'desc' } , 'desc' ] )
147147 }
148148
149149 if ( opts . native ) {
You can’t perform that action at this time.
0 commit comments