1+ import dedent from 'dedent'
12import { describe , expect } from 'vitest'
23import { css , fetchStyles , html , retryAssertion , test , ts , txt } from '../utils'
34
@@ -30,7 +31,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
3031 name : 'recolor' ,
3132 transform (code, id) {
3233 if (id.includes ('.css' )) {
33- return code .replace (/ red/ g, 'blue' )
34+ return code .replace (/ red; / g, 'blue; ' )
3435 }
3536 },
3637 },
@@ -42,7 +43,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
4243 <link rel= "stylesheet" href = "./src/index.css" / >
4344 </ head>
4445 <body>
45- <div class= "foo" > Hello , world !</ div>
46+ <div class= "foo [background-color:red] " > Hello , world !</ div>
4647 </ body>
4748 ` ,
4849 'src/index.css' : css `
@@ -59,7 +60,7 @@ function createSetup(transformer: 'postcss' | 'lightningcss') {
5960
6061for ( let transformer of [ 'postcss' , 'lightningcss' ] as const ) {
6162 describe ( transformer , ( ) => {
62- test ( `production build` , createSetup ( transformer ) , async ( { fs, exec } ) => {
63+ test . only ( `production build` , createSetup ( transformer ) , async ( { fs, exec } ) => {
6364 await exec ( 'pnpm vite build' )
6465
6566 let files = await fs . glob ( 'dist/**/*.css' )
@@ -72,6 +73,12 @@ for (let transformer of ['postcss', 'lightningcss'] as const) {
7273 color : blue;
7374 }
7475 ` ,
76+ // Running the transforms on utilities generated by Tailwind might change in the future
77+ dedent `
78+ .\[background-color\:red \] {
79+ background-color : blue;
80+ }
81+ ` ,
7582 ] )
7683 } )
7784
@@ -86,6 +93,12 @@ for (let transformer of ['postcss', 'lightningcss'] as const) {
8693 color : blue;
8794 }
8895 ` )
96+ // Running the transforms on utilities generated by Tailwind might change in the future
97+ expect ( styles ) . toContain ( dedent `
98+ .\[background-color\:red \] {
99+ background-color : blue;
100+ }
101+ ` )
89102 } )
90103
91104 await retryAssertion ( async ( ) => {
@@ -123,6 +136,12 @@ for (let transformer of ['postcss', 'lightningcss'] as const) {
123136 color : blue;
124137 }
125138 ` )
139+ // Running the transforms on utilities generated by Tailwind might change in the future
140+ expect ( styles ) . toContain ( dedent `
141+ .\[background-color\:red \] {
142+ background-color : blue;
143+ }
144+ ` )
126145 } )
127146
128147 await retryAssertion ( async ( ) => {
0 commit comments