From e66110e6a31e8dcda35c02e6f4aedb546b4c8ff3 Mon Sep 17 00:00:00 2001 From: Adam Wathan <4323180+adamwathan@users.noreply.github.com> Date: Thu, 17 Nov 2022 12:54:28 -0500 Subject: [PATCH] Remove non-obvious unreachable code, add test --- src/util/pluginUtils.js | 2 -- tests/match-utilities.test.js | 31 +++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/util/pluginUtils.js b/src/util/pluginUtils.js index 7f8c4ab74..5c4821d3c 100644 --- a/src/util/pluginUtils.js +++ b/src/util/pluginUtils.js @@ -216,8 +216,6 @@ export function coerceValue(types, modifier, options, tailwindConfig) { return [result, type, null] } - - return [options.values[modifier], 'lookup', null] } if (isArbitraryValue(modifier)) { diff --git a/tests/match-utilities.test.js b/tests/match-utilities.test.js index 0e76373ef..0ba83a0fc 100644 --- a/tests/match-utilities.test.js +++ b/tests/match-utilities.test.js @@ -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`
` }], + 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; + } + `) + }) +})