Skip to content

Commit ab58397

Browse files
committed
test: upgrade tailwind playground to tailwind v4
1 parent b467fa8 commit ab58397

File tree

8 files changed

+581
-53
lines changed

8 files changed

+581
-53
lines changed

playground/tailwind/__tests__/tailwind.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010

1111
test.runIf(isServe)('regenerate CSS and HMR (pug template)', async () => {
1212
const el = await page.$('.pug')
13-
expect(await getBgColor(el)).toBe('rgb(248, 113, 113)')
13+
expect(await getBgColor(el)).toBe('oklch(0.704 0.191 22.216)')
1414

1515
await untilBrowserLogAfter(
1616
() =>
@@ -23,5 +23,5 @@ test.runIf(isServe)('regenerate CSS and HMR (pug template)', async () => {
2323
],
2424
false,
2525
)
26-
await untilUpdated(() => getBgColor(el), 'rgb(220, 38, 38)')
26+
await untilUpdated(() => getBgColor(el), 'oklch(0.577 0.245 27.325)')
2727
})

playground/tailwind/index.css

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import 'tailwindcss';

playground/tailwind/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,13 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"autoprefixer": "^10.4.21",
13+
"@tailwindcss/vite": "^4.1.4",
1414
"tailwindcss": "^4.1.4",
1515
"vue": "catalog:",
1616
"vue-router": "catalog:"
1717
},
1818
"devDependencies": {
1919
"@types/node": "^22.14.1",
20-
"@vitejs/plugin-vue": "workspace:*",
21-
"ts-node": "^10.9.2"
20+
"@vitejs/plugin-vue": "workspace:*"
2221
}
2322
}

playground/tailwind/postcss.config.cts

Lines changed: 0 additions & 6 deletions
This file was deleted.

playground/tailwind/tailwind.config.js

Lines changed: 0 additions & 17 deletions
This file was deleted.

playground/tailwind/vite.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import { defineConfig } from 'vite'
22
import vue from '@vitejs/plugin-vue'
3+
import tailwind from '@tailwindcss/vite'
34

45
export default defineConfig({
5-
plugins: [vue()],
6+
plugins: [vue(), tailwind()],
67
build: {
78
// to make tests faster
89
minify: false,

playground/test-utils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function componentToHex(c: number): string {
5353
return hex.length === 1 ? '0' + hex : hex
5454
}
5555

56-
function rgbToHex(rgb: string): string {
56+
function rgbToHex(rgb: string): string | undefined {
5757
const match = rgb.match(/rgb\((\d+),\s*(\d+),\s*(\d+)\)/)
5858
if (match) {
5959
const [_, rs, gs, bs] = match
@@ -63,9 +63,8 @@ function rgbToHex(rgb: string): string {
6363
componentToHex(parseInt(gs, 10)) +
6464
componentToHex(parseInt(bs, 10))
6565
)
66-
} else {
67-
return '#000000'
6866
}
67+
return undefined
6968
}
7069

7170
const timeout = (n: number) => new Promise((r) => setTimeout(r, n))

0 commit comments

Comments
 (0)