diff --git a/__tests__/resolveConfig.test.js b/__tests__/resolveConfig.test.js index b63a4831c..346710e39 100644 --- a/__tests__/resolveConfig.test.js +++ b/__tests__/resolveConfig.test.js @@ -1059,6 +1059,7 @@ test('theme values in the extend section are lazily evaluated', () => { test('lazily evaluated values have access to the config utils', () => { const userConfig = { theme: { + inset: theme => theme('margin'), shift: (theme, { negative }) => ({ ...theme('spacing'), ...negative(theme('spacing')), @@ -1083,6 +1084,10 @@ test('lazily evaluated values have access to the config utils', () => { '3': '3px', '4': '4px', }, + margin: (theme, { negative }) => ({ + ...theme('spacing'), + ...negative(theme('spacing')), + }), }, variants: {}, } @@ -1100,6 +1105,26 @@ test('lazily evaluated values have access to the config utils', () => { '3': '3px', '4': '4px', }, + inset: { + '-1': '-1px', + '-2': '-2px', + '-3': '-3px', + '-4': '-4px', + '1': '1px', + '2': '2px', + '3': '3px', + '4': '4px', + }, + margin: { + '-1': '-1px', + '-2': '-2px', + '-3': '-3px', + '-4': '-4px', + '1': '1px', + '2': '2px', + '3': '3px', + '4': '4px', + }, shift: { '-1': '-1px', '-2': '-2px', diff --git a/src/util/resolveConfig.js b/src/util/resolveConfig.js index 41e41526d..2a3dc1202 100644 --- a/src/util/resolveConfig.js +++ b/src/util/resolveConfig.js @@ -48,7 +48,7 @@ function resolveFunctionKeys(object) { while (val !== undefined && val !== null && index < path.length) { val = val[path[index++]] - val = isFunction(val) ? val(resolveThemePath) : val + val = isFunction(val) ? val(resolveThemePath, configUtils) : val } return val === undefined ? defaultValue : val