@@ -7,6 +7,7 @@ testRule({
7
7
ruleName,
8
8
config : [ 'percentage' ] ,
9
9
fix : true ,
10
+ computeEditInfo : true ,
10
11
11
12
accept : [
12
13
{
@@ -58,6 +59,10 @@ testRule({
58
59
{
59
60
code : 'a { color: oklch(0.7 0.1 241) }' ,
60
61
fixed : 'a { color: oklch(70% 0.1 241) }' ,
62
+ fix : {
63
+ range : [ 17 , 20 ] ,
64
+ text : '70%' ,
65
+ } ,
61
66
message : messages . expected ( '0.7' , '70%' ) ,
62
67
line : 1 ,
63
68
column : 18 ,
@@ -67,6 +72,10 @@ testRule({
67
72
{
68
73
code : 'a { color: lch(70 0.1 241) }' ,
69
74
fixed : 'a { color: lch(70% 0.1 241) }' ,
75
+ fix : {
76
+ range : [ 16 , 17 ] ,
77
+ text : '0%' ,
78
+ } ,
70
79
message : messages . expected ( '70' , '70%' ) ,
71
80
line : 1 ,
72
81
column : 16 ,
@@ -76,6 +85,10 @@ testRule({
76
85
{
77
86
code : 'a { color: oklab(0.7 0.1 241) }' ,
78
87
fixed : 'a { color: oklab(70% 0.1 241) }' ,
88
+ fix : {
89
+ range : [ 17 , 20 ] ,
90
+ text : '70%' ,
91
+ } ,
79
92
message : messages . expected ( '0.7' , '70%' ) ,
80
93
line : 1 ,
81
94
column : 18 ,
@@ -85,6 +98,10 @@ testRule({
85
98
{
86
99
code : 'a { color: lab(70 0.1 241) }' ,
87
100
fixed : 'a { color: lab(70% 0.1 241) }' ,
101
+ fix : {
102
+ range : [ 16 , 17 ] ,
103
+ text : '0%' ,
104
+ } ,
88
105
message : messages . expected ( '70' , '70%' ) ,
89
106
line : 1 ,
90
107
column : 16 ,
@@ -94,6 +111,10 @@ testRule({
94
111
{
95
112
code : 'a { color: lch(56.29 19.86 200) }' ,
96
113
fixed : 'a { color: lch(56.29% 19.86 200) }' ,
114
+ fix : {
115
+ range : [ 19 , 20 ] ,
116
+ text : '9%' ,
117
+ } ,
97
118
message : messages . expected ( '56.29' , '56.29%' ) ,
98
119
line : 1 ,
99
120
column : 16 ,
@@ -103,6 +124,10 @@ testRule({
103
124
{
104
125
code : 'a { color: oklch(0.5629 0.1 241) }' ,
105
126
fixed : 'a { color: oklch(56.29% 0.1 241) }' ,
127
+ fix : {
128
+ range : [ 17 , 23 ] ,
129
+ text : '56.29%' ,
130
+ } ,
106
131
message : messages . expected ( '0.5629' , '56.29%' ) ,
107
132
line : 1 ,
108
133
column : 18 ,
@@ -112,6 +137,10 @@ testRule({
112
137
{
113
138
code : 'a { color: lch(56.29 19.86 200/ 100%) }' ,
114
139
fixed : 'a { color: lch(56.29% 19.86 200/ 100%) }' ,
140
+ fix : {
141
+ range : [ 19 , 20 ] ,
142
+ text : '9%' ,
143
+ } ,
115
144
message : messages . expected ( '56.29' , '56.29%' ) ,
116
145
line : 1 ,
117
146
column : 16 ,
@@ -121,6 +150,10 @@ testRule({
121
150
{
122
151
code : 'a { color: oklch(/*comment*/0.5629 0.1 241) }' ,
123
152
fixed : 'a { color: oklch(/*comment*/56.29% 0.1 241) }' ,
153
+ fix : {
154
+ range : [ 28 , 34 ] ,
155
+ text : '56.29%' ,
156
+ } ,
124
157
message : messages . expected ( '0.5629' , '56.29%' ) ,
125
158
line : 1 ,
126
159
column : 29 ,
@@ -130,6 +163,10 @@ testRule({
130
163
{
131
164
code : 'a { color: lch(52.9 0.1 241/*comment*/) }' ,
132
165
fixed : 'a { color: lch(52.9% 0.1 241/*comment*/) }' ,
166
+ fix : {
167
+ range : [ 18 , 19 ] ,
168
+ text : '9%' ,
169
+ } ,
133
170
message : messages . expected ( '52.9' , '52.9%' ) ,
134
171
line : 1 ,
135
172
column : 16 ,
@@ -158,13 +195,18 @@ testRule({
158
195
warnings : [
159
196
{
160
197
message : messages . expected ( '29.2345' , '29.2345%' ) ,
198
+ fix : {
199
+ range : [ 64 , 65 ] ,
200
+ text : '5%' ,
201
+ } ,
161
202
line : 4 ,
162
203
column : 7 ,
163
204
endLine : 4 ,
164
205
endColumn : 14 ,
165
206
} ,
166
207
{
167
208
message : messages . expected ( '56.29' , '56.29%' ) ,
209
+ fix : undefined ,
168
210
line : 5 ,
169
211
column : 7 ,
170
212
endLine : 5 ,
@@ -179,6 +221,7 @@ testRule({
179
221
ruleName,
180
222
config : [ 'number' ] ,
181
223
fix : true ,
224
+ computeEditInfo : true ,
182
225
183
226
accept : [
184
227
{
@@ -225,6 +268,10 @@ testRule({
225
268
{
226
269
code : 'a { color: oklch(70% 0.1 241) }' ,
227
270
fixed : 'a { color: oklch(0.7 0.1 241) }' ,
271
+ fix : {
272
+ range : [ 17 , 20 ] ,
273
+ text : '0.7' ,
274
+ } ,
228
275
message : messages . expected ( '70%' , '0.7' ) ,
229
276
line : 1 ,
230
277
column : 18 ,
@@ -234,6 +281,10 @@ testRule({
234
281
{
235
282
code : 'a { color: lch(70% 0.1 241) }' ,
236
283
fixed : 'a { color: lch(70 0.1 241) }' ,
284
+ fix : {
285
+ range : [ 17 , 18 ] ,
286
+ text : '' ,
287
+ } ,
237
288
message : messages . expected ( '70%' , '70' ) ,
238
289
line : 1 ,
239
290
column : 16 ,
@@ -243,6 +294,10 @@ testRule({
243
294
{
244
295
code : 'a { color: oklab(70% 0.1 241) }' ,
245
296
fixed : 'a { color: oklab(0.7 0.1 241) }' ,
297
+ fix : {
298
+ range : [ 17 , 20 ] ,
299
+ text : '0.7' ,
300
+ } ,
246
301
message : messages . expected ( '70%' , '0.7' ) ,
247
302
line : 1 ,
248
303
column : 18 ,
@@ -252,6 +307,10 @@ testRule({
252
307
{
253
308
code : 'a { color: lab(70% 0.1 241) }' ,
254
309
fixed : 'a { color: lab(70 0.1 241) }' ,
310
+ fix : {
311
+ range : [ 17 , 18 ] ,
312
+ text : '' ,
313
+ } ,
255
314
message : messages . expected ( '70%' , '70' ) ,
256
315
line : 1 ,
257
316
column : 16 ,
@@ -261,6 +320,10 @@ testRule({
261
320
{
262
321
code : 'a { color: lch(56.29% 19.86 200) }' ,
263
322
fixed : 'a { color: lch(56.29 19.86 200) }' ,
323
+ fix : {
324
+ range : [ 20 , 21 ] ,
325
+ text : '' ,
326
+ } ,
264
327
message : messages . expected ( '56.29%' , '56.29' ) ,
265
328
line : 1 ,
266
329
column : 16 ,
@@ -270,6 +333,10 @@ testRule({
270
333
{
271
334
code : 'a { color: oklch(56.29% 0.1 241) }' ,
272
335
fixed : 'a { color: oklch(0.5629 0.1 241) }' ,
336
+ fix : {
337
+ range : [ 17 , 23 ] ,
338
+ text : '0.5629' ,
339
+ } ,
273
340
message : messages . expected ( '56.29%' , '0.5629' ) ,
274
341
line : 1 ,
275
342
column : 18 ,
@@ -279,6 +346,10 @@ testRule({
279
346
{
280
347
code : 'a { color: lch(56.29% 19.86 200/ 100%) }' ,
281
348
fixed : 'a { color: lch(56.29 19.86 200/ 100%) }' ,
349
+ fix : {
350
+ range : [ 20 , 21 ] ,
351
+ text : '' ,
352
+ } ,
282
353
message : messages . expected ( '56.29%' , '56.29' ) ,
283
354
line : 1 ,
284
355
column : 16 ,
@@ -288,6 +359,10 @@ testRule({
288
359
{
289
360
code : 'a { color: oklch(/*comment*/56.29% 0.1 241) }' ,
290
361
fixed : 'a { color: oklch(/*comment*/0.5629 0.1 241) }' ,
362
+ fix : {
363
+ range : [ 28 , 34 ] ,
364
+ text : '0.5629' ,
365
+ } ,
291
366
message : messages . expected ( '56.29%' , '0.5629' ) ,
292
367
line : 1 ,
293
368
column : 29 ,
@@ -297,6 +372,10 @@ testRule({
297
372
{
298
373
code : 'a { color: lch(52.9% 0.1 241/*comment*/) }' ,
299
374
fixed : 'a { color: lch(52.9 0.1 241/*comment*/) }' ,
375
+ fix : {
376
+ range : [ 19 , 20 ] ,
377
+ text : '' ,
378
+ } ,
300
379
message : messages . expected ( '52.9%' , '52.9' ) ,
301
380
line : 1 ,
302
381
column : 16 ,
@@ -325,13 +404,18 @@ testRule({
325
404
warnings : [
326
405
{
327
406
message : messages . expected ( '29.2345%' , '29.2345' ) ,
407
+ fix : {
408
+ range : [ 65 , 66 ] ,
409
+ text : '' ,
410
+ } ,
328
411
line : 4 ,
329
412
column : 7 ,
330
413
endLine : 4 ,
331
414
endColumn : 15 ,
332
415
} ,
333
416
{
334
417
message : messages . expected ( '56.29%' , '56.29' ) ,
418
+ fix : undefined ,
335
419
line : 5 ,
336
420
column : 7 ,
337
421
endLine : 5 ,
0 commit comments