1
- const fs = require ( 'fs' )
2
1
const path = require ( 'path' )
3
2
const postcss = require ( 'postcss' )
4
- const tailwindcss = require ( 'tailwindcss' )
3
+ const tailwindcss = require ( 'tailwindcss-legacy ' )
5
4
6
5
async function run ( file ) {
7
6
const { currentTestName } = expect . getState ( )
8
7
9
8
const config = {
10
- content : [ file ] ,
9
+ content : [ `./jest/ ${ file } ` ] ,
11
10
corePlugins : { preflight : false } ,
12
- plugins : [ require ( '../../ src' ) ] ,
11
+ plugins : [ require ( '../src' ) ] ,
13
12
}
14
13
15
14
const result = await postcss ( tailwindcss ( config ) ) . process ( '@tailwind utilities' , {
@@ -20,63 +19,59 @@ async function run(file) {
20
19
}
21
20
22
21
describe ( 'legacy tailwind' , ( ) => {
23
- if ( ! fs . existsSync ( `${ __dirname } /node_modules` ) ) {
24
- throw new Error ( `Dependencies in ${ __dirname } are missing` )
25
- }
26
-
27
22
it ( 'generates `composition` utilities' , async ( ) => {
28
- expect ( await run ( 'jest/ content/composition.html' ) ) . toIncludeAll ( [
23
+ expect ( await run ( 'content/composition.html' ) ) . toIncludeAll ( [
29
24
'.animate-add { animation-composition: add; }' ,
30
25
'.animate-replace { animation-composition: replace; }' ,
31
26
'.animate-accumulate { animation-composition: accumulate; }' ,
32
27
] )
33
28
} )
34
29
35
30
it ( 'should add `delay` utilities' , async ( ) => {
36
- expect ( await run ( 'jest/ content/delay.html' ) ) . toIncludeAll ( [
31
+ expect ( await run ( 'content/delay.html' ) ) . toIncludeAll ( [
37
32
'.animate-delay-75 { animation-delay: 75ms; }' ,
38
33
'.animate-delay-\\[666ms\\] { animation-delay: 666ms; }' ,
39
34
] )
40
35
} )
41
36
42
37
it ( 'generates `direction` utilities' , async ( ) => {
43
- expect ( await run ( 'jest/ content/direction.html' ) ) . toIncludeAll ( [
38
+ expect ( await run ( 'content/direction.html' ) ) . toIncludeAll ( [
44
39
'.animate-normal { animation-direction: normal; }' ,
45
40
'.animate-reverse { animation-direction: reverse; }' ,
46
41
] )
47
42
} )
48
43
49
44
it ( 'generates `duration` utilities' , async ( ) => {
50
- expect ( await run ( 'jest/ content/duration.html' ) ) . toIncludeAll ( [
45
+ expect ( await run ( 'content/duration.html' ) ) . toIncludeAll ( [
51
46
'.animate-duration-75 { animation-duration: 75ms; }' ,
52
47
'.animate-duration-\\[666ms\\] { animation-duration: 666ms; }' ,
53
48
] )
54
49
} )
55
50
56
51
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 ( [
58
53
'.animate-fill-both { animation-fill-mode: both; }' ,
59
54
'.animate-fill-none { animation-fill-mode: normal; }' ,
60
55
] )
61
56
} )
62
57
63
58
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 ( [
65
60
'.animate-infinite { animation-iteration-count: infinite; }' ,
66
61
'.animate-once { animation-iteration-count: 1; }' ,
67
62
'.animate-iteration-\\[14\\] { animation-iteration-count: 14; }' ,
68
63
] )
69
64
} )
70
65
71
66
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 ( [
73
68
'.animate-play { animation-play-state: running; }' ,
74
69
'.animate-stop { animation-play-state: paused; }' ,
75
70
] )
76
71
} )
77
72
78
73
it ( 'generates predefined animations' , async ( ) => {
79
- expect ( await run ( 'jest/ content/predefined-animations.html' ) ) . toIncludeAll ( [
74
+ expect ( await run ( 'content/predefined-animations.html' ) ) . toIncludeAll ( [
80
75
'.animate-fade { animation: fade var(--default-animation-duration, 1s) var(--default-animation-timing-function, ease) var(--default-animation-delay, 0s) both; }' ,
81
76
'@keyframes fade { 0% { opacity: 0; } 100% { opacity: 1; }}' ,
82
77
'.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', () => {
85
80
} )
86
81
87
82
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 ( [
89
84
'.animate-ease { animation-timing-function: ease; }' ,
90
85
'.animate-ease-linear { animation-timing-function: linear; }' ,
91
86
'.animate-ease-\\[cubic-bezier\\(1\\2c 0\\.66\\2c 0\\.33\\2c 0\\)\\] { animation-timing-function: cubic-bezier(1,0.66,0.33,0); }' ,
0 commit comments