Remove non-obvious unreachable code, add test

This commit is contained in:
Adam Wathan 2022-11-17 12:54:28 -05:00
parent fb89b3c8a7
commit e66110e6a3
2 changed files with 31 additions and 2 deletions

View File

@ -216,8 +216,6 @@ export function coerceValue(types, modifier, options, tailwindConfig) {
return [result, type, null]
}
return [options.values[modifier], 'lookup', null]
}
if (isArbitraryValue(modifier)) {

View File

@ -504,3 +504,34 @@ test('matching utilities with a lookup value that looks like a configured value
`)
})
})
test('matching utilities with a lookup value that does not match the configured type', () => {
let config = {
content: [{ raw: html`<div class="test-foo"></div>` }],
theme: {},
plugins: [
function ({ matchUtilities }) {
matchUtilities(
{
test: (value, { modifier }) => ({ value, modifier }),
},
{
values: {
foo: 'not-a-percentage',
},
type: ['percentage'],
}
)
},
],
corePlugins: [],
}
return run('@tailwind utilities', config).then((result) => {
expect(result.css).toMatchCss(css`
.test-foo {
value: not-a-percentage;
}
`)
})
})