From b22a1b17ee8a8e265557fed0fb62af641309c6eb Mon Sep 17 00:00:00 2001 From: Dante <35383529+srdante@users.noreply.github.com> Date: Tue, 28 Dec 2021 06:02:43 -0300 Subject: [PATCH 1/2] Update safelist.test.js --- tests/safelist.test.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/safelist.test.js b/tests/safelist.test.js index d81a6b796ae4..e0daca7e1f6b 100644 --- a/tests/safelist.test.js +++ b/tests/safelist.test.js @@ -222,3 +222,27 @@ 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); + } + `) + }) +}) From a90215631bf5e1fd6fb0ab2ef4faae2ac0091d6b Mon Sep 17 00:00:00 2001 From: Dante <35383529+srdante@users.noreply.github.com> Date: Tue, 28 Dec 2021 06:06:28 -0300 Subject: [PATCH 2/2] Update safelist.test.js --- tests/safelist.test.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/safelist.test.js b/tests/safelist.test.js index e0daca7e1f6b..a8c7ff5cc513 100644 --- a/tests/safelist.test.js +++ b/tests/safelist.test.js @@ -243,6 +243,10 @@ it('should safelist background color opacities based on a pattern regex', () => .bg-red-500\/50 { background-color: rgb(239 68 68 / 0.5); } + + .uppercase { + text-transform: uppercase; + } `) }) })