@@ -11,80 +11,84 @@ function customExtractor(content) {
1111let expectedPath = path . resolve ( __dirname , './custom-extractors.test.css' )
1212let expected = fs . readFileSync ( expectedPath , 'utf8' )
1313
14- test ( 'defaultExtractor' , ( ) => {
15- let config = {
16- content : {
17- content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
18- options : {
19- defaultExtractor : customExtractor ,
14+ describe ( 'modern' , ( ) => {
15+ test ( 'extract.DEFAULT' , ( ) => {
16+ let config = {
17+ content : {
18+ files : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
19+ extract : {
20+ DEFAULT : customExtractor ,
21+ } ,
2022 } ,
21- } ,
22- }
23+ }
2324
24- return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
25- expect ( result . css ) . toMatchFormattedCss ( expected )
25+ return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
26+ expect ( result . css ) . toMatchFormattedCss ( expected )
27+ } )
2628 } )
27- } )
2829
29- test ( 'extractors array' , ( ) => {
30- let config = {
31- content : {
32- content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
33- options : {
34- extractors : [
35- {
36- extractor : customExtractor ,
37- extensions : [ 'html' ] ,
38- } ,
39- ] ,
30+ test ( 'extract.{extension}' , ( ) => {
31+ let config = {
32+ content : {
33+ files : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
34+ extract : {
35+ html : customExtractor ,
36+ } ,
4037 } ,
41- } ,
42- }
38+ }
4339
44- return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
45- expect ( result . css ) . toMatchFormattedCss ( expected )
40+ return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
41+ expect ( result . css ) . toMatchFormattedCss ( expected )
42+ } )
4643 } )
4744} )
4845
49- test ( 'extract function' , ( ) => {
50- let config = {
51- content : {
52- content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
53- extract : customExtractor ,
54- } ,
55- }
46+ describe ( 'legacy' , ( ) => {
47+ test ( 'defaultExtractor' , ( ) => {
48+ let config = {
49+ content : {
50+ content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
51+ options : {
52+ defaultExtractor : customExtractor ,
53+ } ,
54+ } ,
55+ }
5656
57- return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
58- expect ( result . css ) . toMatchFormattedCss ( expected )
57+ return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
58+ expect ( result . css ) . toMatchFormattedCss ( expected )
59+ } )
5960 } )
60- } )
6161
62- test ( 'extract.DEFAULT' , ( ) => {
63- let config = {
64- content : {
65- content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
66- extract : {
67- DEFAULT : customExtractor ,
62+ test ( 'extractors array' , ( ) => {
63+ let config = {
64+ content : {
65+ content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
66+ options : {
67+ extractors : [
68+ {
69+ extractor : customExtractor ,
70+ extensions : [ 'html' ] ,
71+ } ,
72+ ] ,
73+ } ,
6874 } ,
69- } ,
70- }
75+ }
7176
72- return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
73- expect ( result . css ) . toMatchFormattedCss ( expected )
77+ return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
78+ expect ( result . css ) . toMatchFormattedCss ( expected )
79+ } )
7480 } )
75- } )
7681
77- test ( 'extract.{extension}' , ( ) => {
78- let config = {
79- content : {
80- content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
81- extract : {
82- html : customExtractor ,
82+ test ( 'extract function' , ( ) => {
83+ let config = {
84+ content : {
85+ content : [ path . resolve ( __dirname , './custom-extractors.test.html' ) ] ,
86+ extract : customExtractor ,
8387 } ,
84- } ,
85- }
88+ }
8689
87- return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
88- expect ( result . css ) . toMatchFormattedCss ( expected )
90+ return run ( '@tailwind utilities' , config ) . then ( ( result ) => {
91+ expect ( result . css ) . toMatchFormattedCss ( expected )
92+ } )
8993 } )
9094} )
0 commit comments