Skip to content

Commit 46b9a6c

Browse files
committed
fix:修复 textDecoration 属性值错误
1 parent 8a79d76 commit 46b9a6c

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

__test__/fixure/mod.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ export default class Mod extends React.Component {
3434
<>
3535
<img
3636
className='icon'
37+
style={{
38+
color: 'red'
39+
}}
3740
src='//img20.360buyimg.com/img/jfs/t1/166410/12/38783/3147/64f58062Fd7737e2b/5aaf0205cd1ce175.png'
3841
></img>
3942
<>

__test__/index.spec.mjs.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Generated by [AVA](https://avajs.dev).
4040
paddingRight: "8px",␊
4141
paddingTop: "8px",␊
4242
textDecoration: {␊
43-
type: TextDecoration["line-through"],␊
43+
type: TextDecoration["LineThrough"],␊
4444
color: "black"␊
4545
},␊
4646
width: "176px"␊
@@ -91,7 +91,7 @@ Generated by [AVA](https://avajs.dev).
9191
"icon": {␊
9292
height: "18px",␊
9393
textDecoration: {␊
94-
type: TextDecoration["line-through"],␊
94+
type: TextDecoration["LineThrough"],␊
9595
color: "black"␊
9696
},␊
9797
width: "18px"␊
@@ -264,14 +264,15 @@ Generated by [AVA](https://avajs.dev).
264264
265265
<>␊
266266
267-
<img className='icon' src='//img20.360buyimg.com/img/jfs/t1/166410/12/38783/3147/64f58062Fd7737e2b/5aaf0205cd1ce175.png' style={{␊
267+
<img className='icon' style={{␊
268+
color: 'red',␊
268269
height: "18px",␊
269270
textDecoration: {␊
270-
type: TextDecoration["line-through"],␊
271-
color: "black"␊
271+
type: TextDecoration["LineThrough"],␊
272+
color: "red"␊
272273
},␊
273274
width: "18px"␊
274-
}}></img>␊
275+
}} src='//img20.360buyimg.com/img/jfs/t1/166410/12/38783/3147/64f58062Fd7737e2b/5aaf0205cd1ce175.png'></img>␊
275276
276277
<>␊
277278

__test__/index.spec.mjs.snap

3 Bytes
Binary file not shown.

src/style_parser.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ impl ToObjectExpr for TextDecoration {
5555
obj: Box::new(Expr::Ident(Ident::new("TextDecoration".into(), DUMMY_SP))),
5656
prop: MemberProp::Computed(ComputedPropName {
5757
span: DUMMY_SP,
58-
expr: Expr::Lit(Lit::Str(Str::from(self.kind.to_string()))).into(),
58+
expr: Expr::Lit(Lit::Str(Str::from(to_camel_case(self.kind.as_str(), true)))).into(),
5959
}),
6060
})
6161
.into(),

0 commit comments

Comments
 (0)