File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -4665,6 +4665,45 @@ test('addBase', async () => {
46654665 ` )
46664666} )
46674667
4668+ test ( 'JS APIs support @variant' , async ( ) => {
4669+ let { build } = await compile (
4670+ css `
4671+ @plugin "my-plugin" ;
4672+ @layer base, utilities;
4673+ @layer utilities {
4674+ @tailwind utilities;
4675+ }
4676+ ` ,
4677+ {
4678+ loadModule : async ( ) => ( {
4679+ path : '' ,
4680+ base : '/root' ,
4681+ module : ( { addBase } : PluginAPI ) => {
4682+ addBase ( { body : { '@variant dark' : { color : 'red' } } } )
4683+ } ,
4684+ } ) ,
4685+ } ,
4686+ )
4687+
4688+ let compiled = build ( [ 'underline' ] )
4689+
4690+ expect ( optimizeCss ( compiled ) . trim ( ) ) . toMatchInlineSnapshot ( `
4691+ "@layer base {
4692+ @media (prefers-color-scheme: dark) {
4693+ body {
4694+ color: red;
4695+ }
4696+ }
4697+ }
4698+
4699+ @layer utilities {
4700+ .underline {
4701+ text-decoration-line: underline;
4702+ }
4703+ }"
4704+ ` )
4705+ } )
4706+
46684707it ( "should error when `layer(…)` is used, but it's not the first param" , async ( ) => {
46694708 await expect ( async ( ) => {
46704709 return await compileCss (
You can’t perform that action at this time.
0 commit comments