@@ -87,6 +87,68 @@ withFixture('basic', (c) => {
87
87
} ,
88
88
] ,
89
89
} )
90
+
91
+ testColors ( 'gradient utilities show colors' , {
92
+ text : '<div class="from-black from-black/50 via-black via-black/50 to-black to-black/50">' ,
93
+ expected : [
94
+ {
95
+ range : { start : { line : 0 , character : 12 } , end : { line : 0 , character : 22 } } ,
96
+ color : {
97
+ alpha : 1 ,
98
+ red : 0 ,
99
+ green : 0 ,
100
+ blue : 0 ,
101
+ } ,
102
+ } ,
103
+ {
104
+ range : { start : { line : 0 , character : 23 } , end : { line : 0 , character : 36 } } ,
105
+ color : {
106
+ alpha : 0.5 ,
107
+ red : 0 ,
108
+ green : 0 ,
109
+ blue : 0 ,
110
+ } ,
111
+ } ,
112
+
113
+ {
114
+ range : { start : { line : 0 , character : 37 } , end : { line : 0 , character : 46 } } ,
115
+ color : {
116
+ alpha : 1 ,
117
+ red : 0 ,
118
+ green : 0 ,
119
+ blue : 0 ,
120
+ } ,
121
+ } ,
122
+ {
123
+ range : { start : { line : 0 , character : 47 } , end : { line : 0 , character : 59 } } ,
124
+ color : {
125
+ alpha : 0.5 ,
126
+ red : 0 ,
127
+ green : 0 ,
128
+ blue : 0 ,
129
+ } ,
130
+ } ,
131
+
132
+ {
133
+ range : { start : { line : 0 , character : 60 } , end : { line : 0 , character : 68 } } ,
134
+ color : {
135
+ alpha : 1 ,
136
+ red : 0 ,
137
+ green : 0 ,
138
+ blue : 0 ,
139
+ } ,
140
+ } ,
141
+ {
142
+ range : { start : { line : 0 , character : 69 } , end : { line : 0 , character : 80 } } ,
143
+ color : {
144
+ alpha : 0.5 ,
145
+ red : 0 ,
146
+ green : 0 ,
147
+ blue : 0 ,
148
+ } ,
149
+ } ,
150
+ ] ,
151
+ } )
90
152
} )
91
153
92
154
withFixture ( 'v4/basic' , ( c ) => {
@@ -116,7 +178,6 @@ withFixture('v4/basic', (c) => {
116
178
] ,
117
179
} )
118
180
119
- /*
120
181
testColors ( 'opacity modifier' , {
121
182
text : '<div class="bg-red-500/20">' ,
122
183
expected : [
@@ -131,7 +192,6 @@ withFixture('v4/basic', (c) => {
131
192
} ,
132
193
] ,
133
194
} )
134
- */
135
195
136
196
testColors ( 'arbitrary value' , {
137
197
text : '<div class="bg-[red]">' ,
@@ -148,7 +208,6 @@ withFixture('v4/basic', (c) => {
148
208
] ,
149
209
} )
150
210
151
- /*
152
211
testColors ( 'arbitrary value and opacity modifier' , {
153
212
text : '<div class="bg-[red]/[0.5]">' ,
154
213
expected : [
@@ -163,7 +222,6 @@ withFixture('v4/basic', (c) => {
163
222
} ,
164
223
] ,
165
224
} )
166
- */
167
225
168
226
testColors ( 'oklch colors are parsed' , {
169
227
text : '<div class="bg-[oklch(60%_0.25_25)]">' ,
@@ -179,4 +237,66 @@ withFixture('v4/basic', (c) => {
179
237
} ,
180
238
] ,
181
239
} )
240
+
241
+ testColors ( 'gradient utilities show colors' , {
242
+ text : '<div class="from-black from-black/50 via-black via-black/50 to-black to-black/50">' ,
243
+ expected : [
244
+ {
245
+ range : { start : { line : 0 , character : 12 } , end : { line : 0 , character : 22 } } ,
246
+ color : {
247
+ alpha : 1 ,
248
+ red : 0 ,
249
+ green : 0 ,
250
+ blue : 0 ,
251
+ } ,
252
+ } ,
253
+ {
254
+ range : { start : { line : 0 , character : 23 } , end : { line : 0 , character : 36 } } ,
255
+ color : {
256
+ alpha : 0.5 ,
257
+ red : 0 ,
258
+ green : 0 ,
259
+ blue : 0 ,
260
+ } ,
261
+ } ,
262
+
263
+ {
264
+ range : { start : { line : 0 , character : 37 } , end : { line : 0 , character : 46 } } ,
265
+ color : {
266
+ alpha : 1 ,
267
+ red : 0 ,
268
+ green : 0 ,
269
+ blue : 0 ,
270
+ } ,
271
+ } ,
272
+ {
273
+ range : { start : { line : 0 , character : 47 } , end : { line : 0 , character : 59 } } ,
274
+ color : {
275
+ alpha : 0.5 ,
276
+ red : 0 ,
277
+ green : 0 ,
278
+ blue : 0 ,
279
+ } ,
280
+ } ,
281
+
282
+ {
283
+ range : { start : { line : 0 , character : 60 } , end : { line : 0 , character : 68 } } ,
284
+ color : {
285
+ alpha : 1 ,
286
+ red : 0 ,
287
+ green : 0 ,
288
+ blue : 0 ,
289
+ } ,
290
+ } ,
291
+ {
292
+ range : { start : { line : 0 , character : 69 } , end : { line : 0 , character : 80 } } ,
293
+ color : {
294
+ alpha : 0.5 ,
295
+ red : 0 ,
296
+ green : 0 ,
297
+ blue : 0 ,
298
+ } ,
299
+ } ,
300
+ ] ,
301
+ } )
182
302
} )
0 commit comments