From 70fd34350b1bff7cf7e130461ed6438d8adcd589 Mon Sep 17 00:00:00 2001 From: Hernan Alvarado Date: Thu, 24 Oct 2024 08:56:44 -0500 Subject: [PATCH] test: add tests for `pseudo-classes-utilities` --- .../tailwindcss-utilities/test/index.test.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/tailwindcss-utilities/test/index.test.ts b/packages/tailwindcss-utilities/test/index.test.ts index 9a7aed5..e4dc629 100644 --- a/packages/tailwindcss-utilities/test/index.test.ts +++ b/packages/tailwindcss-utilities/test/index.test.ts @@ -71,3 +71,28 @@ describe("min-width utilities", () => { }) }) }) + +describe("psuedo classes utilities", () => { + const testCases = [ + { + input: `
`, + output: ".where-\\[div\\]\\:w-10:where(div){width:2.5rem}", + }, + { + input: `
`, + output: ".is-\\[div\\]\\:w-10:is(div){width:2.5rem}", + }, + { + input: `
`, + output: "w-10{width:2.5rem}.not-\\[ul\\]\\:w-1\\.5:not(ul){width:0.375rem}", + }, + ] + testCases.forEach(({ input, output }) => { + const extract = input.match(/class="([^"]*)"/)?.[1] + test.concurrent(`generate the css for ${extract}`, async ({ expect }) => { + const css = await generateClasses(input) + console.log(css) + expect(css).toMatch(output) + }) + }) +})