@@ -24,12 +24,12 @@ describe('preset', () => {
2424 } ,
2525 } ) ,
2626 ) . toMatchInlineSnapshot ( `
27- "import React from \\"react\\";
28-
29- const SvgComponent = () => <svg foo=\\"bar\\" x={y} />;
30-
31- export default SvgComponent;"
32- ` )
27+ "import React from \\"react\\";
28+
29+ const SvgComponent = () => <svg foo=\\"bar\\" x={y} />;
30+
31+ export default SvgComponent;"
32+ `)
3333 } )
3434
3535 it ( 'should handle native expo option' , ( ) => {
@@ -41,13 +41,13 @@ export default SvgComponent;"
4141 } ,
4242 } ) ,
4343 ) . toMatchInlineSnapshot ( `
44- "import React from \\"react\\";
45- import { Svg } from \\"expo\\";
46-
47- const SvgComponent = () => <Svg><Svg.G><Svg.Path d=\\"M0 0h48v1H0z\\" /></Svg.G></Svg>;
48-
49- export default SvgComponent;"
50- ` )
44+ "import React from \\"react\\";
45+ import { Svg } from \\"expo\\";
46+
47+ const SvgComponent = () => <Svg><Svg.G><Svg.Path d=\\"M0 0h48v1H0z\\" /></Svg.G></Svg>;
48+
49+ export default SvgComponent;"
50+ `)
5151 } )
5252
5353 it ( 'should handle titleProp' , ( ) => {
@@ -59,14 +59,14 @@ export default SvgComponent;"
5959 } ,
6060 } ) ,
6161 ) . toMatchInlineSnapshot ( `
62- "import React from \\"react\\";
63-
64- const SvgComponent = ({
65- title
66- }) => <svg><title>{title}</title></svg>;
67-
68- export default SvgComponent;"
69- ` )
62+ "import React from \\"react\\";
63+
64+ const SvgComponent = ({
65+ title
66+ }) => <svg><title>{title}</title></svg>;
67+
68+ export default SvgComponent;"
69+ `)
7070 } )
7171
7272 it ( 'should handle replaceAttrValues' , ( ) => {
@@ -81,11 +81,30 @@ export default SvgComponent;"
8181 } ,
8282 } ) ,
8383 ) . toMatchInlineSnapshot ( `
84- "import React from \\"react\\";
85-
86- const SvgComponent = () => <svg a=\\"black\\" b={props.white} />;
84+ "import React from \\"react\\";
85+
86+ const SvgComponent = () => <svg a=\\"black\\" b={props.white} />;
87+
88+ export default SvgComponent;"
89+ ` )
90+ } )
8791
88- export default SvgComponent;"
89- ` )
92+ it ( 'should handle expandProps & icon & dimensions' , ( ) => {
93+ expect (
94+ testPreset ( '<svg a="#000" b="#fff" />' , {
95+ expandProps : 'end' ,
96+ icon : true ,
97+ dimensions : true ,
98+ state : {
99+ componentName : 'SvgComponent' ,
100+ } ,
101+ } ) ,
102+ ) . toMatchInlineSnapshot ( `
103+ "import React from \\"react\\";
104+
105+ const SvgComponent = props => <svg a=\\"#000\\" b=\\"#fff\\" width=\\"1em\\" height=\\"1em\\" {...props} />;
106+
107+ export default SvgComponent;"
108+ ` )
90109 } )
91110} )
0 commit comments