From f5e8c746395c44928572834afae27a31b5f37367 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 22 Mar 2019 13:13:39 -0400 Subject: [PATCH] Don't mutate variants in user's config --- __tests__/resolveConfig.test.js | 8 +++++++- src/util/resolveConfig.js | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/__tests__/resolveConfig.test.js b/__tests__/resolveConfig.test.js index e75b47b79..58cadc288 100644 --- a/__tests__/resolveConfig.test.js +++ b/__tests__/resolveConfig.test.js @@ -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'], + } }) }) diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js index 10eefc0ef..58c080eb6 100644 --- a/src/util/resolveConfig.js +++ b/src/util/resolveConfig.js @@ -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 )