diff --git a/tests/safelist.test.js b/tests/safelist.test.js index d81a6b796ae4..a8c7ff5cc513 100644 --- a/tests/safelist.test.js +++ b/tests/safelist.test.js @@ -222,3 +222,31 @@ it('should safelist negatives based on a pattern regex', () => { `) }) }) + +it('should safelist background color opacities based on a pattern regex', () => { + let config = { + content: [{ raw: html`
` }], + safelist: [ + { + pattern: /^bg-red-(100|500\/50)$/, + }, + ], + } + + return run('@tailwind utilities', config).then((result) => { + return expect(result.css).toMatchCss(css` + .bg-red-100 { + --tw-bg-opacity: 1; + background-color: rgb(254 226 226 / var(--tw-bg-opacity)); + } + + .bg-red-500\/50 { + background-color: rgb(239 68 68 / 0.5); + } + + .uppercase { + text-transform: uppercase; + } + `) + }) +})