File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 {
66 "targets" : {
77 "node" : " 6"
8- }
8+ },
9+ "loose" : true
910 }
1011 ]
1112 ],
Original file line number Diff line number Diff line change @@ -232,6 +232,21 @@ export default One;
232232"
233233` ;
234234
235+ exports [` cli --tab-width 1` ] = `
236+ "import React from \\ "react\\ ";
237+
238+ const One = props => (
239+ <svg width = { 48 } height = { 1 } viewBox =\\"0 0 48 1\\" { ... props } >
240+ <title >Rectangle 5</title >
241+ <path d =\\"M0 0h48v1H0z\\" fill =\\"#063855\\" fillRule =\\"evenodd\\" />
242+ </svg >
243+ );
244+
245+ export default One;
246+
247+ "
248+ ` ;
249+
235250exports [` cli --template 1` ] = `
236251"import React from \\ "react\\ ";
237252
Original file line number Diff line number Diff line change @@ -36,13 +36,15 @@ program
3636 . option (
3737 '-p, --precision <value>' ,
3838 'set the number of digits in the fractional part (svgo)' ,
39+ parseInt ,
3940 )
4041 . option ( '--ids' , 'keep ids within the svg (svgo)' )
4142 . option ( '--keep-useless-defs' , 'keep elements of <defs> without id (svgo)' )
4243 . option ( '--no-title' , 'remove title tag (svgo)' )
4344 . option (
44- '--tab-width' ,
45+ '--tab-width <value> ' ,
4546 'specify the number of spaces by indentation-level (prettier)' ,
47+ parseInt ,
4648 )
4749 . option ( '--use-tabs' , 'indent lines with tabs instead of spaces (prettier)' )
4850 . option ( '--no-semi' , 'remove semi-colons (prettier)' )
Original file line number Diff line number Diff line change @@ -64,7 +64,12 @@ describe('cli', () => {
6464 } )
6565
6666 it ( '--precision' , async ( ) => {
67- const [ stdout ] = await exec ( 'bin/svgr --precision 1 __fixtures__/one.svg' )
67+ const [ stdout ] = await exec ( 'bin/svgr --precision 10 __fixtures__/one.svg' )
68+ expect ( stdout ) . toMatchSnapshot ( )
69+ } )
70+
71+ it ( '--tab-width' , async ( ) => {
72+ const [ stdout ] = await exec ( 'bin/svgr --tab-width 4 __fixtures__/one.svg' )
6873 expect ( stdout ) . toMatchSnapshot ( )
6974 } )
7075
You can’t perform that action at this time.
0 commit comments