Don't mutate variants in user's config

This commit is contained in:
Adam Wathan 2019-03-22 13:13:39 -04:00
parent 7e1113561a
commit f5e8c74639
2 changed files with 8 additions and 2 deletions

View File

@ -836,6 +836,9 @@ test('the original theme is not mutated', () => {
},
},
},
variants: {
borderColor: ['responsive', 'hover'],
}
}
const defaultConfig = {
@ -850,7 +853,7 @@ test('the original theme is not mutated', () => {
},
},
variants: {
borderColor: ['responsive', 'hover', 'focus'],
backgroundColor: ['responsive', 'hover', 'focus'],
},
}
@ -864,5 +867,8 @@ test('the original theme is not mutated', () => {
},
},
},
variants: {
borderColor: ['responsive', 'hover'],
}
})
})

View File

@ -39,7 +39,7 @@ export default function resolveConfig(configs) {
return defaults(
{
theme: resolveFunctionKeys(mergeExtensions(defaults({}, ...map(configs, 'theme')))),
variants: defaults(...map(configs, 'variants')),
variants: defaults({}, ...map(configs, 'variants')),
},
...configs
)