@cwcss/crosswind 0.1.5 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +52 -0
- package/dist/bin/cli.js +14615 -0
- package/dist/build.d.ts +24 -0
- package/dist/config.d.ts +5 -0
- package/dist/generator.d.ts +31 -0
- package/dist/index.d.ts +10 -0
- package/dist/parser.d.ts +42 -0
- package/dist/plugin.d.ts +22 -0
- package/dist/preflight-forms.d.ts +5 -0
- package/dist/preflight.d.ts +2 -0
- package/dist/rules-advanced.d.ts +27 -0
- package/dist/rules-effects.d.ts +25 -0
- package/dist/rules-forms.d.ts +7 -0
- package/dist/rules-grid.d.ts +13 -0
- package/dist/rules-interactivity.d.ts +41 -0
- package/dist/rules-layout.d.ts +26 -0
- package/dist/rules-transforms.d.ts +33 -0
- package/dist/rules-typography.d.ts +41 -0
- package/dist/rules.d.ts +39 -0
- package/dist/scanner.d.ts +18 -0
- package/dist/src/index.js +12848 -0
- package/dist/transformer-compile-class.d.ts +37 -0
- package/{src/types.ts → dist/types.d.ts} +17 -86
- package/package.json +2 -16
- package/PLUGIN.md +0 -235
- package/benchmark/framework-comparison.bench.ts +0 -850
- package/bin/cli.ts +0 -365
- package/bin/crosswind +0 -0
- package/bin/headwind +0 -0
- package/build.ts +0 -8
- package/crosswind.config.ts +0 -9
- package/example/comprehensive.html +0 -70
- package/example/index.html +0 -21
- package/example/output.css +0 -236
- package/examples/plugin/README.md +0 -112
- package/examples/plugin/build.ts +0 -32
- package/examples/plugin/src/index.html +0 -34
- package/examples/plugin/src/index.ts +0 -7
- package/headwind +0 -2
- package/src/build.ts +0 -101
- package/src/config.ts +0 -529
- package/src/generator.ts +0 -2173
- package/src/index.ts +0 -10
- package/src/parser.ts +0 -1471
- package/src/plugin.ts +0 -118
- package/src/preflight-forms.ts +0 -229
- package/src/preflight.ts +0 -388
- package/src/rules-advanced.ts +0 -477
- package/src/rules-effects.ts +0 -461
- package/src/rules-forms.ts +0 -103
- package/src/rules-grid.ts +0 -241
- package/src/rules-interactivity.ts +0 -525
- package/src/rules-layout.ts +0 -385
- package/src/rules-transforms.ts +0 -412
- package/src/rules-typography.ts +0 -486
- package/src/rules.ts +0 -809
- package/src/scanner.ts +0 -84
- package/src/transformer-compile-class.ts +0 -275
- package/test/advanced-features.test.ts +0 -911
- package/test/arbitrary.test.ts +0 -396
- package/test/attributify.test.ts +0 -592
- package/test/bracket-syntax.test.ts +0 -1133
- package/test/build.test.ts +0 -99
- package/test/colors.test.ts +0 -934
- package/test/flexbox.test.ts +0 -669
- package/test/generator.test.ts +0 -597
- package/test/grid.test.ts +0 -584
- package/test/layout.test.ts +0 -404
- package/test/modifiers.test.ts +0 -417
- package/test/parser.test.ts +0 -564
- package/test/performance-regression.test.ts +0 -376
- package/test/performance.test.ts +0 -568
- package/test/plugin.test.ts +0 -160
- package/test/scanner.test.ts +0 -94
- package/test/sizing.test.ts +0 -481
- package/test/spacing.test.ts +0 -394
- package/test/transformer-compile-class.test.ts +0 -287
- package/test/transforms.test.ts +0 -448
- package/test/typography.test.ts +0 -632
- package/test/variants-form-states.test.ts +0 -225
- package/test/variants-group-peer.test.ts +0 -66
- package/test/variants-media.test.ts +0 -213
- package/test/variants-positional.test.ts +0 -58
- package/test/variants-pseudo-elements.test.ts +0 -47
- package/test/variants-state.test.ts +0 -62
- package/tsconfig.json +0 -18
package/test/modifiers.test.ts
DELETED
|
@@ -1,417 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'bun:test'
|
|
2
|
-
import { defaultConfig } from '../src/config'
|
|
3
|
-
import { CSSGenerator } from '../src/generator'
|
|
4
|
-
|
|
5
|
-
describe('Modifiers', () => {
|
|
6
|
-
describe('Important modifier', () => {
|
|
7
|
-
it('should add !important to utilities', () => {
|
|
8
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
9
|
-
gen.generate('!p-4')
|
|
10
|
-
expect(gen.toCSS(false)).toContain('padding: 1rem !important;')
|
|
11
|
-
})
|
|
12
|
-
|
|
13
|
-
it('should work with arbitrary values', () => {
|
|
14
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
15
|
-
gen.generate('!w-[100px]')
|
|
16
|
-
expect(gen.toCSS(false)).toContain('width: 100px !important;')
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
it('should work with colors', () => {
|
|
20
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
21
|
-
gen.generate('!bg-gray-500')
|
|
22
|
-
expect(gen.toCSS(false)).toContain('background-color: oklch(55.1% 0.027 264.364) !important;')
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
it('should work with variants', () => {
|
|
26
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
27
|
-
gen.generate('!placeholder:text-gray-400')
|
|
28
|
-
expect(gen.toCSS(false)).toContain('!important')
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
it('should work with ring-offset', () => {
|
|
32
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
33
|
-
gen.generate('!ring-offset-4')
|
|
34
|
-
expect(gen.toCSS(false)).toContain('!important')
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('should work with container', () => {
|
|
38
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
39
|
-
gen.generate('!container')
|
|
40
|
-
expect(gen.toCSS(false)).toContain('!important')
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
it('should work with before pseudo-element', () => {
|
|
44
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
45
|
-
gen.generate('!before:block')
|
|
46
|
-
const css = gen.toCSS(false)
|
|
47
|
-
expect(css).toContain('::before')
|
|
48
|
-
expect(css).toContain('!important')
|
|
49
|
-
})
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
describe('Edge Cases', () => {
|
|
53
|
-
describe('Important with all utility types', () => {
|
|
54
|
-
it('should work with display utilities', () => {
|
|
55
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
56
|
-
gen.generate('!block')
|
|
57
|
-
expect(gen.toCSS(false)).toContain('display: block !important;')
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
it('should work with flexbox utilities', () => {
|
|
61
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
62
|
-
gen.generate('!flex-col')
|
|
63
|
-
expect(gen.toCSS(false)).toContain('flex-direction: column !important;')
|
|
64
|
-
})
|
|
65
|
-
|
|
66
|
-
it('should work with grid utilities', () => {
|
|
67
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
68
|
-
gen.generate('!grid-cols-3')
|
|
69
|
-
expect(gen.toCSS(false)).toContain('grid-template-columns: repeat(3, minmax(0, 1fr)) !important;')
|
|
70
|
-
})
|
|
71
|
-
|
|
72
|
-
it('should work with transform utilities', () => {
|
|
73
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
74
|
-
gen.generate('!rotate-45')
|
|
75
|
-
expect(gen.toCSS(false)).toContain('transform: rotate(45deg) !important;')
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
it('should work with opacity', () => {
|
|
79
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
80
|
-
gen.generate('!opacity-50')
|
|
81
|
-
expect(gen.toCSS(false)).toContain('opacity: 0.5 !important;')
|
|
82
|
-
})
|
|
83
|
-
|
|
84
|
-
it('should work with border utilities', () => {
|
|
85
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
86
|
-
gen.generate('!border')
|
|
87
|
-
expect(gen.toCSS(false)).toContain('border-width: 1px !important;')
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
it('should work with rounded utilities', () => {
|
|
91
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
92
|
-
gen.generate('!rounded-lg')
|
|
93
|
-
expect(gen.toCSS(false)).toContain('border-radius: 0.5rem !important;')
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it('should work with shadow utilities', () => {
|
|
97
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
98
|
-
gen.generate('!shadow-md')
|
|
99
|
-
expect(gen.toCSS(false)).toContain('box-shadow:')
|
|
100
|
-
expect(gen.toCSS(false)).toContain('!important')
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
describe('Important with responsive variants', () => {
|
|
105
|
-
it('should work with md breakpoint', () => {
|
|
106
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
107
|
-
gen.generate('!md:p-8')
|
|
108
|
-
const css = gen.toCSS(false)
|
|
109
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
110
|
-
expect(css).toContain('padding: 2rem !important;')
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('should work with lg breakpoint', () => {
|
|
114
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
115
|
-
gen.generate('!lg:text-2xl')
|
|
116
|
-
const css = gen.toCSS(false)
|
|
117
|
-
expect(css).toContain('@media (min-width: 1024px)')
|
|
118
|
-
expect(css).toContain('!important')
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
it('should work with multiple responsive utilities', () => {
|
|
122
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
123
|
-
gen.generate('!sm:w-full')
|
|
124
|
-
gen.generate('!md:w-1/2')
|
|
125
|
-
gen.generate('!lg:w-1/3')
|
|
126
|
-
const css = gen.toCSS(false)
|
|
127
|
-
expect(css).toContain('@media (min-width: 640px)')
|
|
128
|
-
expect(css).toContain('@media (min-width: 768px)')
|
|
129
|
-
expect(css).toContain('@media (min-width: 1024px)')
|
|
130
|
-
})
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
describe('Important with state variants', () => {
|
|
134
|
-
it('should work with hover', () => {
|
|
135
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
136
|
-
gen.generate('!hover:bg-blue-500')
|
|
137
|
-
const css = gen.toCSS(false)
|
|
138
|
-
expect(css).toContain(':hover')
|
|
139
|
-
expect(css).toContain('!important')
|
|
140
|
-
})
|
|
141
|
-
|
|
142
|
-
it('should work with focus', () => {
|
|
143
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
144
|
-
gen.generate('!focus:outline-none')
|
|
145
|
-
const css = gen.toCSS(false)
|
|
146
|
-
expect(css).toContain(':focus')
|
|
147
|
-
expect(css).toContain('!important')
|
|
148
|
-
})
|
|
149
|
-
|
|
150
|
-
it('should work with active', () => {
|
|
151
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
152
|
-
gen.generate('!active:scale-95')
|
|
153
|
-
const css = gen.toCSS(false)
|
|
154
|
-
expect(css).toContain(':active')
|
|
155
|
-
expect(css).toContain('!important')
|
|
156
|
-
})
|
|
157
|
-
|
|
158
|
-
it('should work with disabled', () => {
|
|
159
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
160
|
-
gen.generate('!disabled:opacity-50')
|
|
161
|
-
const css = gen.toCSS(false)
|
|
162
|
-
expect(css).toContain(':disabled')
|
|
163
|
-
expect(css).toContain('!important')
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
it('should work with checked', () => {
|
|
167
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
168
|
-
gen.generate('!checked:bg-green-500')
|
|
169
|
-
const css = gen.toCSS(false)
|
|
170
|
-
expect(css).toContain(':checked')
|
|
171
|
-
expect(css).toContain('!important')
|
|
172
|
-
})
|
|
173
|
-
})
|
|
174
|
-
|
|
175
|
-
describe('Important with pseudo-elements', () => {
|
|
176
|
-
it('should work with after', () => {
|
|
177
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
178
|
-
gen.generate('!after:content-["*"]')
|
|
179
|
-
const css = gen.toCSS(false)
|
|
180
|
-
expect(css).toContain('::after')
|
|
181
|
-
expect(css).toContain('!important')
|
|
182
|
-
})
|
|
183
|
-
|
|
184
|
-
it('should work with marker', () => {
|
|
185
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
186
|
-
gen.generate('!marker:text-red-500')
|
|
187
|
-
const css = gen.toCSS(false)
|
|
188
|
-
expect(css).toContain('::marker')
|
|
189
|
-
expect(css).toContain('!important')
|
|
190
|
-
})
|
|
191
|
-
|
|
192
|
-
it('should work with selection', () => {
|
|
193
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
194
|
-
gen.generate('!selection:bg-yellow-100')
|
|
195
|
-
const css = gen.toCSS(false)
|
|
196
|
-
expect(css).toContain('::selection')
|
|
197
|
-
expect(css).toContain('!important')
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
it('should work with placeholder', () => {
|
|
201
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
202
|
-
gen.generate('!placeholder:text-gray-400')
|
|
203
|
-
const css = gen.toCSS(false)
|
|
204
|
-
expect(css).toContain('::placeholder')
|
|
205
|
-
expect(css).toContain('!important')
|
|
206
|
-
})
|
|
207
|
-
})
|
|
208
|
-
|
|
209
|
-
describe('Important with group/peer variants', () => {
|
|
210
|
-
it('should work with group-hover', () => {
|
|
211
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
212
|
-
gen.generate('!group-hover:visible')
|
|
213
|
-
const css = gen.toCSS(false)
|
|
214
|
-
expect(css).toContain('.group:hover')
|
|
215
|
-
expect(css).toContain('!important')
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
it('should work with peer-checked', () => {
|
|
219
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
220
|
-
gen.generate('!peer-checked:block')
|
|
221
|
-
const css = gen.toCSS(false)
|
|
222
|
-
expect(css).toContain('.peer:checked')
|
|
223
|
-
expect(css).toContain('!important')
|
|
224
|
-
})
|
|
225
|
-
})
|
|
226
|
-
|
|
227
|
-
describe('Important with dark mode', () => {
|
|
228
|
-
it('should work with dark variant', () => {
|
|
229
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
230
|
-
gen.generate('!dark:bg-gray-900')
|
|
231
|
-
const css = gen.toCSS(false)
|
|
232
|
-
expect(css).toContain('.dark')
|
|
233
|
-
expect(css).toContain('!important')
|
|
234
|
-
})
|
|
235
|
-
|
|
236
|
-
it('should work with dark and hover combined', () => {
|
|
237
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
238
|
-
gen.generate('!dark:hover:bg-gray-800')
|
|
239
|
-
const css = gen.toCSS(false)
|
|
240
|
-
expect(css).toContain('.dark')
|
|
241
|
-
expect(css).toContain(':hover')
|
|
242
|
-
expect(css).toContain('!important')
|
|
243
|
-
})
|
|
244
|
-
})
|
|
245
|
-
|
|
246
|
-
describe('Important with positional variants', () => {
|
|
247
|
-
it('should work with first', () => {
|
|
248
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
249
|
-
gen.generate('!first:mt-0')
|
|
250
|
-
const css = gen.toCSS(false)
|
|
251
|
-
expect(css).toContain(':first-child')
|
|
252
|
-
expect(css).toContain('!important')
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
it('should work with last', () => {
|
|
256
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
257
|
-
gen.generate('!last:mb-0')
|
|
258
|
-
const css = gen.toCSS(false)
|
|
259
|
-
expect(css).toContain(':last-child')
|
|
260
|
-
expect(css).toContain('!important')
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
it('should work with odd', () => {
|
|
264
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
265
|
-
gen.generate('!odd:bg-gray-50')
|
|
266
|
-
const css = gen.toCSS(false)
|
|
267
|
-
expect(css).toContain(':nth-child(odd)')
|
|
268
|
-
expect(css).toContain('!important')
|
|
269
|
-
})
|
|
270
|
-
|
|
271
|
-
it('should work with even', () => {
|
|
272
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
273
|
-
gen.generate('!even:bg-gray-100')
|
|
274
|
-
const css = gen.toCSS(false)
|
|
275
|
-
expect(css).toContain(':nth-child(even)')
|
|
276
|
-
expect(css).toContain('!important')
|
|
277
|
-
})
|
|
278
|
-
})
|
|
279
|
-
|
|
280
|
-
describe('Important with arbitrary values', () => {
|
|
281
|
-
it('should work with arbitrary width', () => {
|
|
282
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
283
|
-
gen.generate('!w-[350px]')
|
|
284
|
-
expect(gen.toCSS(false)).toContain('width: 350px !important;')
|
|
285
|
-
})
|
|
286
|
-
|
|
287
|
-
it('should work with arbitrary color', () => {
|
|
288
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
289
|
-
gen.generate('!bg-[#1a1a1a]')
|
|
290
|
-
expect(gen.toCSS(false)).toContain('background-color: #1a1a1a !important;')
|
|
291
|
-
})
|
|
292
|
-
|
|
293
|
-
it('should work with arbitrary spacing', () => {
|
|
294
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
295
|
-
gen.generate('!gap-[2.5rem]')
|
|
296
|
-
expect(gen.toCSS(false)).toContain('gap: 2.5rem !important;')
|
|
297
|
-
})
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
describe('Important with complex combinations', () => {
|
|
301
|
-
it('should work with responsive + hover + important', () => {
|
|
302
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
303
|
-
gen.generate('!md:hover:scale-110')
|
|
304
|
-
const css = gen.toCSS(false)
|
|
305
|
-
expect(css).toContain('@media')
|
|
306
|
-
expect(css).toContain(':hover')
|
|
307
|
-
expect(css).toContain('!important')
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
it('should work with dark + responsive + state', () => {
|
|
311
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
312
|
-
gen.generate('!dark:lg:focus:ring-2')
|
|
313
|
-
const css = gen.toCSS(false)
|
|
314
|
-
expect(css).toContain('.dark')
|
|
315
|
-
expect(css).toContain('@media')
|
|
316
|
-
expect(css).toContain(':focus')
|
|
317
|
-
expect(css).toContain('!important')
|
|
318
|
-
})
|
|
319
|
-
|
|
320
|
-
it('should work with group + responsive + important', () => {
|
|
321
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
322
|
-
gen.generate('!sm:group-hover:opacity-100')
|
|
323
|
-
const css = gen.toCSS(false)
|
|
324
|
-
expect(css).toContain('@media')
|
|
325
|
-
expect(css).toContain('.group:hover')
|
|
326
|
-
expect(css).toContain('!important')
|
|
327
|
-
})
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
describe('Important edge cases', () => {
|
|
331
|
-
it('should handle important on negative values', () => {
|
|
332
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
333
|
-
gen.generate('!-m-4')
|
|
334
|
-
expect(gen.toCSS(false)).toContain('margin: -1rem !important;')
|
|
335
|
-
})
|
|
336
|
-
|
|
337
|
-
it('should handle important with zero values', () => {
|
|
338
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
339
|
-
gen.generate('!p-0')
|
|
340
|
-
expect(gen.toCSS(false)).toContain('padding: 0 !important;')
|
|
341
|
-
})
|
|
342
|
-
|
|
343
|
-
it('should handle important with fractional values', () => {
|
|
344
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
345
|
-
gen.generate('!w-1/2')
|
|
346
|
-
expect(gen.toCSS(false)).toContain('width: 50% !important;')
|
|
347
|
-
})
|
|
348
|
-
|
|
349
|
-
it('should preserve important through multiple utilities', () => {
|
|
350
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
351
|
-
gen.generate('!p-4')
|
|
352
|
-
gen.generate('!m-2')
|
|
353
|
-
const css = gen.toCSS(false)
|
|
354
|
-
expect(css).toContain('padding: 1rem !important;')
|
|
355
|
-
expect(css).toContain('margin: 0.5rem !important;')
|
|
356
|
-
})
|
|
357
|
-
})
|
|
358
|
-
|
|
359
|
-
describe('Extreme variant stacking', () => {
|
|
360
|
-
it('should handle 10+ stacked variants', () => {
|
|
361
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
362
|
-
gen.generate('sm:md:lg:xl:2xl:hover:focus:active:dark:group-hover:w-4')
|
|
363
|
-
const css = gen.toCSS(false)
|
|
364
|
-
expect(css).toContain('width')
|
|
365
|
-
})
|
|
366
|
-
|
|
367
|
-
it('should handle duplicate variants', () => {
|
|
368
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
369
|
-
gen.generate('hover:hover:hover:bg-blue-500')
|
|
370
|
-
const css = gen.toCSS(false)
|
|
371
|
-
expect(css).toContain('background-color')
|
|
372
|
-
})
|
|
373
|
-
|
|
374
|
-
it('should handle conflicting responsive variants', () => {
|
|
375
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
376
|
-
gen.generate('sm:lg:md:xl:w-full')
|
|
377
|
-
const css = gen.toCSS(false)
|
|
378
|
-
// Should handle all variants even if order seems wrong
|
|
379
|
-
expect(css.length).toBeGreaterThan(0)
|
|
380
|
-
})
|
|
381
|
-
|
|
382
|
-
it('should handle all pseudo-class variants together', () => {
|
|
383
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
384
|
-
gen.generate('hover:focus:active:visited:disabled:checked:bg-red-500')
|
|
385
|
-
const css = gen.toCSS(false)
|
|
386
|
-
expect(css).toContain(':hover')
|
|
387
|
-
expect(css).toContain(':focus')
|
|
388
|
-
})
|
|
389
|
-
|
|
390
|
-
it('should handle mixing responsive and pseudo-elements', () => {
|
|
391
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
392
|
-
gen.generate('md:before:content-["test"]')
|
|
393
|
-
gen.generate('lg:after:block')
|
|
394
|
-
const css = gen.toCSS(false)
|
|
395
|
-
expect(css).toContain('::before')
|
|
396
|
-
expect(css).toContain('::after')
|
|
397
|
-
})
|
|
398
|
-
|
|
399
|
-
it('should handle group and peer variants together', () => {
|
|
400
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
401
|
-
gen.generate('group-hover:peer-focus:bg-blue-500')
|
|
402
|
-
const css = gen.toCSS(false)
|
|
403
|
-
// Complex stacking of group and peer variants
|
|
404
|
-
// Generator handles these by applying the variants in order
|
|
405
|
-
expect(css).toContain('background-color')
|
|
406
|
-
expect(css).toContain('oklch(62.3% 0.214 259.815)')
|
|
407
|
-
})
|
|
408
|
-
|
|
409
|
-
it('should handle important with all variant types', () => {
|
|
410
|
-
const gen = new CSSGenerator(defaultConfig)
|
|
411
|
-
gen.generate('!sm:hover:dark:first:bg-red-500')
|
|
412
|
-
const css = gen.toCSS(false)
|
|
413
|
-
expect(css).toContain('!important')
|
|
414
|
-
})
|
|
415
|
-
})
|
|
416
|
-
})
|
|
417
|
-
})
|