Skip to content

Commit d1cce4c

Browse files
committed
update tests
1 parent 8e033dd commit d1cce4c

File tree

5 files changed

+14
-32
lines changed

5 files changed

+14
-32
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ jobs:
1313
with:
1414
node-version: '20.x'
1515
- run: npm install
16-
- run: npm install --prefix jest/legacy
1716
- run: npm test
1817

1918
publish:

.github/workflows/tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,5 @@ jobs:
1515
with:
1616
node-version: ${{ matrix.node-version }}
1717
- run: npm install
18-
- run: npm install --prefix jest/legacy
1918
- run: npm run lint
2019
- run: npm run test

jest/legacy/index.test.js renamed to jest/legacy.test.js

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
const fs = require('fs')
21
const path = require('path')
32
const postcss = require('postcss')
4-
const tailwindcss = require('tailwindcss')
3+
const tailwindcss = require('tailwindcss-legacy')
54

65
async function run(file) {
76
const { currentTestName } = expect.getState()
87

98
const config = {
10-
content: [file],
9+
content: [`./jest/${file}`],
1110
corePlugins: { preflight: false },
12-
plugins: [require('../../src')],
11+
plugins: [require('../src')],
1312
}
1413

1514
const result = await postcss(tailwindcss(config)).process('@tailwind utilities', {
@@ -20,63 +19,59 @@ async function run(file) {
2019
}
2120

2221
describe('legacy tailwind', () => {
23-
if (! fs.existsSync(`${__dirname}/node_modules`)) {
24-
throw new Error(`Dependencies in ${__dirname} are missing`)
25-
}
26-
2722
it('generates `composition` utilities', async () => {
28-
expect(await run('jest/content/composition.html')).toIncludeAll([
23+
expect(await run('content/composition.html')).toIncludeAll([
2924
'.animate-add { animation-composition: add; }',
3025
'.animate-replace { animation-composition: replace; }',
3126
'.animate-accumulate { animation-composition: accumulate; }',
3227
])
3328
})
3429

3530
it('should add `delay` utilities', async () => {
36-
expect(await run('jest/content/delay.html')).toIncludeAll([
31+
expect(await run('content/delay.html')).toIncludeAll([
3732
'.animate-delay-75 { animation-delay: 75ms; }',
3833
'.animate-delay-\\[666ms\\] { animation-delay: 666ms; }',
3934
])
4035
})
4136

4237
it('generates `direction` utilities', async () => {
43-
expect(await run('jest/content/direction.html')).toIncludeAll([
38+
expect(await run('content/direction.html')).toIncludeAll([
4439
'.animate-normal { animation-direction: normal; }',
4540
'.animate-reverse { animation-direction: reverse; }',
4641
])
4742
})
4843

4944
it('generates `duration` utilities', async () => {
50-
expect(await run('jest/content/duration.html')).toIncludeAll([
45+
expect(await run('content/duration.html')).toIncludeAll([
5146
'.animate-duration-75 { animation-duration: 75ms; }',
5247
'.animate-duration-\\[666ms\\] { animation-duration: 666ms; }',
5348
])
5449
})
5550

5651
it('generates `fill-mode` utilities', async () => {
57-
expect(await run('jest/content/fill-mode.html')).toIncludeAll([
52+
expect(await run('content/fill-mode.html')).toIncludeAll([
5853
'.animate-fill-both { animation-fill-mode: both; }',
5954
'.animate-fill-none { animation-fill-mode: normal; }',
6055
])
6156
})
6257

6358
it('generates `iteration-count` utilities', async () => {
64-
expect(await run('jest/content/iteration-count.html')).toIncludeAll([
59+
expect(await run('content/iteration-count.html')).toIncludeAll([
6560
'.animate-infinite { animation-iteration-count: infinite; }',
6661
'.animate-once { animation-iteration-count: 1; }',
6762
'.animate-iteration-\\[14\\] { animation-iteration-count: 14; }',
6863
])
6964
})
7065

7166
it('generates `play-state` utilities', async () => {
72-
expect(await run('jest/content/play-state.html')).toIncludeAll([
67+
expect(await run('content/play-state.html')).toIncludeAll([
7368
'.animate-play { animation-play-state: running; }',
7469
'.animate-stop { animation-play-state: paused; }',
7570
])
7671
})
7772

7873
it('generates predefined animations', async () => {
79-
expect(await run('jest/content/predefined-animations.html')).toIncludeAll([
74+
expect(await run('content/predefined-animations.html')).toIncludeAll([
8075
'.animate-fade { animation: fade var(--default-animation-duration, 1s) var(--default-animation-timing-function, ease) var(--default-animation-delay, 0s) both; }',
8176
'@keyframes fade { 0% { opacity: 0; } 100% { opacity: 1; }}',
8277
'.animate-spin { animation: spin var(--default-animation-duration, 1s) var(--default-animation-timing-function, linear) var(--default-animation-delay, 0s) infinite; }',
@@ -85,7 +80,7 @@ describe('legacy tailwind', () => {
8580
})
8681

8782
it('generates `timing-function` utilities', async () => {
88-
expect(await run('jest/content/timing-function.html')).toIncludeAll([
83+
expect(await run('content/timing-function.html')).toIncludeAll([
8984
'.animate-ease { animation-timing-function: ease; }',
9085
'.animate-ease-linear { animation-timing-function: linear; }',
9186
'.animate-ease-\\[cubic-bezier\\(1\\2c 0\\.66\\2c 0\\.33\\2c 0\\)\\] { animation-timing-function: cubic-bezier(1,0.66,0.33,0); }',

jest/legacy/package.json

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

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"eslint": "^9.18.0",
4040
"eslint-plugin-jest": "^28.11.0",
4141
"jest": "^29.7.0",
42-
"postcss": "^8.5.1",
43-
"tailwindcss": "^4.0.0"
42+
"tailwindcss": "^4.0.0",
43+
"tailwindcss-legacy": "npm:[email protected].0"
4444
}
4545
}

0 commit comments

Comments
 (0)