@@ -17,7 +17,7 @@ const testPreset = (code: string, options: Partial<Options>) => {
1717}
1818
1919describe ( 'preset' , ( ) => {
20- it ( 'should handle svgProps' , ( ) => {
20+ it ( 'handles svgProps' , ( ) => {
2121 expect (
2222 testPreset ( '<svg />' , {
2323 svgProps : {
@@ -34,7 +34,7 @@ describe('preset', () => {
3434 ` )
3535 } )
3636
37- it ( 'should handle titleProp' , ( ) => {
37+ it ( 'handles titleProp' , ( ) => {
3838 expect (
3939 testPreset ( '<svg></svg>' , {
4040 titleProp : true ,
@@ -50,7 +50,7 @@ describe('preset', () => {
5050 export default SvgComponent;"
5151 ` )
5252 } )
53- it ( 'should handle titleProp and fallback on existing title' , ( ) => {
53+ it ( 'handles titleProp and fallback on existing title' , ( ) => {
5454 // testing when existing title has string as chilren
5555 expect (
5656 testPreset ( `<svg><title>Hello</title></svg>` , {
@@ -83,7 +83,7 @@ describe('preset', () => {
8383 ` )
8484 } )
8585
86- it ( 'should handle replaceAttrValues' , ( ) => {
86+ it ( 'handles replaceAttrValues' , ( ) => {
8787 expect (
8888 testPreset ( '<svg a="#000" b="#fff" />' , {
8989 replaceAttrValues : {
@@ -100,7 +100,7 @@ describe('preset', () => {
100100 ` )
101101 } )
102102
103- it ( 'should handle expandProps & icon & dimensions' , ( ) => {
103+ it ( 'handles expandProps & icon & dimensions' , ( ) => {
104104 expect (
105105 testPreset ( '<svg a="#000" b="#fff" />' , {
106106 expandProps : 'end' ,
@@ -115,4 +115,38 @@ describe('preset', () => {
115115 export default SvgComponent;"
116116 ` )
117117 } )
118+
119+ it ( 'handles custom icon size' , ( ) => {
120+ expect (
121+ testPreset ( '<svg a="#000" b="#fff" />' , {
122+ expandProps : 'end' ,
123+ icon : 24 ,
124+ dimensions : true ,
125+ } ) ,
126+ ) . toMatchInlineSnapshot ( `
127+ "import * as React from \\"react\\";
128+
129+ const SvgComponent = props => <svg a=\\"#000\\" b=\\"#fff\\" width={24} height={24} {...props} />;
130+
131+ export default SvgComponent;"
132+ ` )
133+ } )
134+
135+ it ( 'defaults to 24 on native' , ( ) => {
136+ expect (
137+ testPreset ( '<svg a="#000" b="#fff" />' , {
138+ expandProps : 'end' ,
139+ icon : true ,
140+ native : true ,
141+ dimensions : true ,
142+ } ) ,
143+ ) . toMatchInlineSnapshot ( `
144+ "import * as React from \\"react\\";
145+ import Svg from \\"react-native-svg\\";
146+
147+ const SvgComponent = props => <Svg a=\\"#000\\" b=\\"#fff\\" width={24} height={24} {...props} />;
148+
149+ export default SvgComponent;"
150+ ` )
151+ } )
118152} )
0 commit comments