@@ -88,5 +88,38 @@ test('fixes colon instead of semicolon', () => {
88
88
equal ( root . toString ( ) , 'a { one: 1: } b { one: 1 : }' )
89
89
} )
90
90
91
+ test ( 'fixes {} error' , ( ) => {
92
+ let root = parse ( `:root { --example-var: { "Version": { "Build": "10.30.7.350828.20230224122352", "Source": "10.30.7.350828.1", "Required": "10.30.7.307232"; }}}; @font-face { font-family: 'Calibri'; }` )
93
+ equal ( root . toString ( ) , `:root { --example-var: { "Version": { "Build": "10.30.7.350828.20230224122352", "Source": "10.30.7.350828.1", "Required": "10.30.7.307232"; }}}; @font-face { font-family: 'Calibri'; }` )
94
+ } )
95
+
96
+ test ( 'Rule at the start of tokens' , ( ) => {
97
+ let root = parse ( `.start { font-size: 16px; }` ) ;
98
+ equal ( root . toString ( ) , `.start { font-size: 16px; }` ) ;
99
+ } ) ;
100
+
101
+ test ( 'Complex nested structures with JSON-like properties' , ( ) => {
102
+ let root = parse ( `:root { --complex: {"nested": {"key": "value"}, "array": [1, {"sub": "value"}]}; } @font-face { font-family: 'Calibri'; }` ) ;
103
+ equal ( root . toString ( ) , `:root { --complex: {"nested": {"key": "value"}, "array": [1, {"sub": "value"}]}; } @font-face { font-family: 'Calibri'; }` ) ;
104
+ } ) ;
105
+
106
+ test ( 'Multiple rules with one JSON-like custom property' , ( ) => {
107
+ let root = parse ( `
108
+ .class1 { margin: 10px; }
109
+ :root { --jsonProp: {"a": 1, "b": {"c": 3}}; }
110
+ .class2 { padding: 20px; }
111
+ ` ) ;
112
+ equal ( root . toString ( ) , `
113
+ .class1 { margin: 10px; }
114
+ :root { --jsonProp: {"a": 1, "b": {"c": 3}}; }
115
+ .class2 { padding: 20px; }
116
+ ` ) ;
117
+ } ) ;
118
+
119
+ test ( 'Custom property at start without modifications' , ( ) => {
120
+ let root = parse ( `--example: {"key": "value"}; .class { color: black; }` ) ;
121
+ equal ( root . toString ( ) , `--example: {"key": "value"}; .class { color: black; }` ) ;
122
+ } ) ;
123
+
91
124
test . run ( )
92
125
0 commit comments