File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ /**
4
+ * Module dependencies.
5
+ */
6
+ var assert = require ( 'assert' ) ;
7
+ var attributesToProps = require ( '../lib/attributes-to-props' ) ;
8
+
9
+ /**
10
+ * Tests for attributes to props helper.
11
+ */
12
+ describe ( 'attributes to props helper' , function ( ) {
13
+
14
+ it ( 'converts CSS style string to JS style object' , function ( ) {
15
+ // proper css
16
+ assert . deepEqual (
17
+ attributesToProps ( {
18
+ style : 'color: #f00; font-size: 42px; z-index: -1;'
19
+ } ) ,
20
+ {
21
+ style : {
22
+ color : '#f00' ,
23
+ fontSize : '42px' ,
24
+ zIndex : '-1'
25
+ }
26
+ }
27
+ ) ;
28
+
29
+ // valid but messy
30
+ assert . deepEqual (
31
+ attributesToProps ( {
32
+ style : 'border-bottom-left-radius:1em;border-right-style:solid;Z-Index:-1'
33
+ } ) ,
34
+ {
35
+ style : {
36
+ borderBottomLeftRadius : '1em' ,
37
+ borderRightStyle : 'solid' ,
38
+ zIndex : '-1'
39
+ }
40
+ }
41
+ ) ;
42
+ } ) ;
43
+
44
+ } ) ;
You can’t perform that action at this time.
0 commit comments