@@ -204,6 +204,57 @@ describe('sva', () => {
204
204
padding : 4 ,
205
205
} ) ;
206
206
} ) ;
207
+
208
+ it ( 'should support compound variants with array of values' , ( ) => {
209
+ const { sva } = defineTokens ( { } ) ;
210
+ const buttonStyles = sva ( {
211
+ base : { display : 'flex' } ,
212
+ variants : {
213
+ visual : {
214
+ solid : { backgroundColor : '#FC8181' } ,
215
+ outline : { borderWidth : 1 } ,
216
+ } ,
217
+ size : {
218
+ sm : { padding : 4 } ,
219
+ md : { padding : 6 } ,
220
+ lg : { padding : 8 } ,
221
+ } ,
222
+ } ,
223
+ compoundVariants : [
224
+ {
225
+ variants : { visual : 'solid' , size : [ 'md' , 'lg' ] } ,
226
+ style : { fontWeight : 'bold' } ,
227
+ } ,
228
+ ] ,
229
+ defaultVariants : {
230
+ visual : 'solid' ,
231
+ size : 'sm' ,
232
+ } ,
233
+ } ) ;
234
+
235
+ // Test compound variant with size md (should match the array)
236
+ expect ( buttonStyles ( { visual : 'solid' , size : 'md' } ) ) . toEqual ( {
237
+ display : 'flex' ,
238
+ backgroundColor : '#FC8181' ,
239
+ padding : 6 ,
240
+ fontWeight : 'bold' ,
241
+ } ) ;
242
+
243
+ // Test compound variant with size lg (should match the array)
244
+ expect ( buttonStyles ( { visual : 'solid' , size : 'lg' } ) ) . toEqual ( {
245
+ display : 'flex' ,
246
+ backgroundColor : '#FC8181' ,
247
+ padding : 8 ,
248
+ fontWeight : 'bold' ,
249
+ } ) ;
250
+
251
+ // Test without triggering compound variant (size sm not in array)
252
+ expect ( buttonStyles ( { visual : 'solid' , size : 'sm' } ) ) . toEqual ( {
253
+ display : 'flex' ,
254
+ backgroundColor : '#FC8181' ,
255
+ padding : 4 ,
256
+ } ) ;
257
+ } ) ;
207
258
} ) ;
208
259
209
260
describe ( 'defineTokens' , ( ) => {
0 commit comments