Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add UI tests
  • Loading branch information
thecrypticace committed Mar 28, 2025
commit 03b5e2a68c08c8a384a1e6f258fd45d8e56027be
46 changes: 46 additions & 0 deletions packages/tailwindcss/tests/ui.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ test('shadow colors', async ({ page }) => {
<div id="e" class="shadow-sm shadow-red hover:shadow-xl hover:shadow-initial">
Hello world
</div>

<div id="f" class="shadow-xs/75">Hello world</div>
<div id="g" class="shadow-xs/75 shadow-red/75">Hello world</div>
`,
)

Expand Down Expand Up @@ -291,6 +294,22 @@ test('shadow colors', async ({ page }) => {
expect.stringMatching(/oklab\(0.627\d+ 0.224\d+ 0.125\d+\) 0px 1px 2px -1px/),
])

expect(await getPropertyList('#f', 'box-shadow')).toEqual([
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'oklab(0 0 0 / 0.75) 0px 1px 2px 0px',
])

expect(await getPropertyList('#g', 'box-shadow')).toEqual([
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
expect.stringMatching(/oklab\(0.627\d+ 0.224\d+ 0.125\d+ \/ 0.56\d+\) 0px 1px 2px 0px/),
])

await page.locator('#d').hover()

expect(await getPropertyList('#d', 'box-shadow')).toEqual([
Expand Down Expand Up @@ -343,6 +362,9 @@ test('inset shadow colors', async ({ page }) => {
>
Hello world
</div>

<div id="f" class="inset-shadow-xs/75">Hello world</div>
<div id="g" class="inset-shadow-xs/75 inset-shadow-red/75">Hello world</div>
`,
)

Expand Down Expand Up @@ -376,6 +398,22 @@ test('inset shadow colors', async ({ page }) => {
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
])

expect(await getPropertyList('#f', 'box-shadow')).toEqual([
'oklab(0 0 0 / 0.75) 0px 1px 1px 0px inset',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
])

expect(await getPropertyList('#g', 'box-shadow')).toEqual([
expect.stringMatching(/oklab\(0.627\d+ 0.224\d+ 0.125\d+ \/ 0.56\d+\) 0px 1px 1px 0px inset/),
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
])

await page.locator('#d').hover()

expect(await getPropertyList('#d', 'box-shadow')).toEqual([
Expand Down Expand Up @@ -419,6 +457,9 @@ test('text shadow colors', async ({ page }) => {
>
Hello world
</div>

<div id="f" class="text-shadow-xs/75">Hello world</div>
<div id="g" class="text-shadow-xs/75 text-shadow-red/75">Hello world</div>
`,
)

Expand All @@ -435,6 +476,11 @@ test('text shadow colors', async ({ page }) => {
/oklab\(0.627\d+ 0.224\d+ 0.125\d+\) 0px 1px 1px/,
)

expect(await getPropertyValue('#f', 'text-shadow')).toEqual('oklab(0 0 0 / 0.75) 0px 1px 1px')
expect(await getPropertyValue('#g', 'text-shadow')).toMatch(
/oklab\(0.627\d+ 0.224\d+ 0.125\d+ \/ 0.56\d+\) 0px 1px 1px/,
)

await page.locator('#d').hover()

expect(await getPropertyValue('#d', 'text-shadow')).toMatch(
Expand Down