Skip to content

Commit

Permalink
test: add tests for pseudo-classes-utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
halvaradop committed Oct 24, 2024
1 parent 6a21b76 commit 70fd343
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/tailwindcss-utilities/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,28 @@ describe("min-width utilities", () => {
})
})
})

describe("psuedo classes utilities", () => {
const testCases = [
{
input: `<div class="where-[div]:w-10"></div>`,
output: ".where-\\[div\\]\\:w-10:where(div){width:2.5rem}",
},
{
input: `<div class="is-[div]:w-10"></div>`,
output: ".is-\\[div\\]\\:w-10:is(div){width:2.5rem}",
},
{
input: `<div class="w-10 not-[ul]:w-1.5"></div>`,
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)
})
})
})

0 comments on commit 70fd343

Please sign in to comment.