diff --git a/tests/arbitrary-values.test.js b/tests/arbitrary-values.test.js index baea4ddef..069393b1f 100644 --- a/tests/arbitrary-values.test.js +++ b/tests/arbitrary-values.test.js @@ -416,3 +416,78 @@ it('should correctly validate each part when checking for `percentage` data type `) }) }) + +it('arbitrary-value looking things in the config are preferred', () => { + let config = { + content: [{ raw: html`
` }], + corePlugins: { preflight: false, backgroundOpacity: false }, + plugins: [], + theme: { + colors: { + '[#c0ffee]': '#f0000d', + }, + }, + } + + let input = css` + @tailwind utilities; + ` + + return run(input, config).then((result) => { + expect(result.css).toMatchFormattedCss(css` + .bg-\[\#c0ffee\] { + background-color: #f0000d; + } + `) + }) +}) + +it('modifier-value looking things in the config are preferred', () => { + let config = { + content: [{ raw: html`` }], + corePlugins: { preflight: false, backgroundOpacity: false }, + plugins: [], + theme: { + colors: { + 'red-500/50': '#f0000d', + }, + }, + } + + let input = css` + @tailwind utilities; + ` + + return run(input, config).then((result) => { + expect(result.css).toMatchFormattedCss(css` + .bg-red-500\/50 { + background-color: #f0000d; + } + `) + }) +}) + +it('modifier-value looking things in the config are preferred', () => { + let config = { + content: [{ raw: html`` }], + corePlugins: { preflight: false, backgroundOpacity: false }, + plugins: [], + theme: { + colors: { + '[#ff0000]': '#f0000d', + }, + }, + } + + let input = css` + @tailwind utilities; + ` + + return run(input, config).then((result) => { + expect(result.css).toMatchFormattedCss(css` + .bg-\[\#ff0000\]\/\[0\.5\] { + background-color: rgb(240 0 13 / 0.5); + } + `) + }) +})