Ensure all function properties receive config utils
This commit is contained in:
parent
c2dcecfff6
commit
e3576242a4
2 changed files with 26 additions and 1 deletions
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue