@@ -55,7 +55,7 @@ describe('transformJsx', () => {
5555
5656 expect ( transform ( code , { plugins : [ transformJsx ] } ) . trim ( ) )
5757 . toBe ( `{/*?xml version="1.0" encoding="UTF-8"?*/}
58- <svg width="88px" height="88px" viewBox="0 0 88 88" version=" 1.1" xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
58+ <svg width="88px" height="88px" viewBox="0 0 88 88" version={ 1.1} xmlns="http://www.w3.org/2000/svg" xmlnsXlink="http://www.w3.org/1999/xlink">
5959 {/*Generator: Sketch 46.2 (44496) - http://www.bohemiancoding.com/sketch*/}
6060 <title>
6161 Dismiss
@@ -70,18 +70,25 @@ describe('transformJsx', () => {
7070 </linearGradient>
7171 <filter id="b" width="157.1%" height="180%" x="-28.6%" y="-20%" filterUnits="objectBoundingBox">
7272 <feOffset dy={1} in="SourceAlpha" result="shadowOffsetOuter1" />
73- <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation=".5" />
73+ <feGaussianBlur in="shadowOffsetOuter1" result="shadowBlurOuter1" stdDeviation={.5} />
7474 <feColorMatrix in="shadowBlurOuter1" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.2 0" />
7575 </filter>
7676 </defs>
7777 <g id="Blocks" stroke="none" strokeWidth={1} fill="none" fillRule="evenodd" strokeLinecap="square">
7878 <g id="Dismiss" stroke="#063855" strokeWidth={2}>
7979 <path d="M51,37 L37,51" id="Shape" />
8080 <path d="M51,51 L37,37" id="Shape" />
81- <circle cx=" 43.5" cy=" 42.5" r=" 31.5" fill="url(#a)" opacity=".1" />
82- <circle fill="#f00" cx=" 43.5" cy=" 42.5" r=" 21.5" filter="url(#b)" opacity={1} />
81+ <circle cx={ 43.5} cy={ 42.5} r={ 31.5} fill="url(#a)" opacity={.1} />
82+ <circle fill="#f00" cx={ 43.5} cy={ 42.5} r={ 21.5} filter="url(#b)" opacity={1} />
8383 </g>
8484 </g>
8585</svg>` )
8686 } )
87+
88+ it ( 'should handle convert style attribute to object' , ( ) => {
89+ const code = `<div id="foo" style="font-size: 10px; line-height: 1.2;"></div>`
90+ expect ( transform ( code , { plugins : [ transformJsx ] } ) . trim ( ) ) . toBe (
91+ `<div id="foo" style={{"fontSize":10,"lineHeight":1.2}} />` ,
92+ )
93+ } )
8794} )
0 commit comments