@@ -261,6 +261,70 @@ test('variants key is merged instead of replaced', () => {
261261 } )
262262} )
263263
264+ test ( 'a global variants list replaces the default' , ( ) => {
265+ const userConfig = {
266+ variants : [ 'responsive' , 'hover' , 'focus' , 'active' ] ,
267+ }
268+
269+ const defaultConfig = {
270+ prefix : '-' ,
271+ important : false ,
272+ separator : ':' ,
273+ theme : {
274+ colors : {
275+ 'grey-darker' : '#606f7b' ,
276+ 'grey-dark' : '#8795a1' ,
277+ grey : '#b8c2cc' ,
278+ 'grey-light' : '#dae1e7' ,
279+ 'grey-lighter' : '#f1f5f8' ,
280+ } ,
281+ fonts : {
282+ sans : [ 'system-ui' , 'BlinkMacSystemFont' , '-apple-system' , 'Roboto' , 'sans-serif' ] ,
283+ serif : [ 'Constantia' , 'Lucida Bright' , 'Georgia' , 'serif' ] ,
284+ } ,
285+ screens : {
286+ sm : '500px' ,
287+ md : '750px' ,
288+ lg : '1000px' ,
289+ } ,
290+ } ,
291+ variants : {
292+ appearance : [ 'responsive' ] ,
293+ backgroundAttachment : [ 'responsive' ] ,
294+ borderCollapse : [ ] ,
295+ borderColors : [ 'responsive' , 'hover' , 'focus' ] ,
296+ borderRadius : [ 'responsive' ] ,
297+ } ,
298+ }
299+
300+ const result = resolveConfig ( [ userConfig , defaultConfig ] )
301+
302+ expect ( result ) . toEqual ( {
303+ prefix : '-' ,
304+ important : false ,
305+ separator : ':' ,
306+ theme : {
307+ colors : {
308+ 'grey-darker' : '#606f7b' ,
309+ 'grey-dark' : '#8795a1' ,
310+ grey : '#b8c2cc' ,
311+ 'grey-light' : '#dae1e7' ,
312+ 'grey-lighter' : '#f1f5f8' ,
313+ } ,
314+ fonts : {
315+ sans : [ 'system-ui' , 'BlinkMacSystemFont' , '-apple-system' , 'Roboto' , 'sans-serif' ] ,
316+ serif : [ 'Constantia' , 'Lucida Bright' , 'Georgia' , 'serif' ] ,
317+ } ,
318+ screens : {
319+ sm : '500px' ,
320+ md : '750px' ,
321+ lg : '1000px' ,
322+ } ,
323+ } ,
324+ variants : [ 'responsive' , 'hover' , 'focus' , 'active' ] ,
325+ } )
326+ } )
327+
264328test ( 'missing top level keys are pulled from the default config' , ( ) => {
265329 const userConfig = { }
266330
0 commit comments