Skip to content

Commit a7b00c5

Browse files
committed
Add UI tests
1 parent ca056c0 commit a7b00c5

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

packages/tailwindcss/tests/ui.spec.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ test('shadow colors', async ({ page }) => {
245245
<div id="e" class="shadow-sm shadow-red hover:shadow-xl hover:shadow-initial">
246246
Hello world
247247
</div>
248+
249+
<div id="f" class="shadow-xs/75">Hello world</div>
250+
<div id="g" class="shadow-xs/75 shadow-red/75">Hello world</div>
248251
`,
249252
)
250253

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

297+
expect(await getPropertyList('#f', 'box-shadow')).toEqual([
298+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
299+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
300+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
301+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
302+
'oklab(0 0 0 / 0.75) 0px 1px 2px 0px',
303+
])
304+
305+
expect(await getPropertyList('#g', 'box-shadow')).toEqual([
306+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
307+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
308+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
309+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
310+
expect.stringMatching(/oklab\(0.627\d+ 0.224\d+ 0.125\d+ \/ 0.56\d+\) 0px 1px 2px 0px/),
311+
])
312+
294313
await page.locator('#d').hover()
295314

296315
expect(await getPropertyList('#d', 'box-shadow')).toEqual([
@@ -343,6 +362,9 @@ test('inset shadow colors', async ({ page }) => {
343362
>
344363
Hello world
345364
</div>
365+
366+
<div id="f" class="inset-shadow-xs/75">Hello world</div>
367+
<div id="g" class="inset-shadow-xs/75 inset-shadow-red/75">Hello world</div>
346368
`,
347369
)
348370

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

401+
expect(await getPropertyList('#f', 'box-shadow')).toEqual([
402+
'oklab(0 0 0 / 0.75) 0px 1px 1px 0px inset',
403+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
404+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
405+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
406+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
407+
])
408+
409+
expect(await getPropertyList('#g', 'box-shadow')).toEqual([
410+
expect.stringMatching(/oklab\(0.627\d+ 0.224\d+ 0.125\d+ \/ 0.56\d+\) 0px 1px 1px 0px inset/),
411+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
412+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
413+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
414+
'rgba(0, 0, 0, 0) 0px 0px 0px 0px',
415+
])
416+
379417
await page.locator('#d').hover()
380418

381419
expect(await getPropertyList('#d', 'box-shadow')).toEqual([
@@ -419,6 +457,9 @@ test('text shadow colors', async ({ page }) => {
419457
>
420458
Hello world
421459
</div>
460+
461+
<div id="f" class="text-shadow-xs/75">Hello world</div>
462+
<div id="g" class="text-shadow-xs/75 text-shadow-red/75">Hello world</div>
422463
`,
423464
)
424465

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

479+
expect(await getPropertyValue('#f', 'text-shadow')).toEqual('oklab(0 0 0 / 0.75) 0px 1px 1px')
480+
expect(await getPropertyValue('#g', 'text-shadow')).toMatch(
481+
/oklab\(0.627\d+ 0.224\d+ 0.125\d+ \/ 0.56\d+\) 0px 1px 1px/,
482+
)
483+
438484
await page.locator('#d').hover()
439485

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

0 commit comments

Comments
 (0)