@@ -332,6 +332,57 @@ describe("Tailwind 3", function () {
332332 ]
333333 } ) ;
334334 } ) ;
335+
336+ it ( "should parse @apply with slash notation for opacity modifiers" , ( ) => {
337+ const testCases = [
338+ "a { @apply outline-ring/50; }" ,
339+ "a { @apply bg-blue-500/30; }" ,
340+ "a { @apply border-gray-200/50; }" ,
341+ ] ;
342+
343+ testCases . forEach ( ( testCase ) => {
344+ assert . doesNotThrow ( ( ) => {
345+ const result = parse ( testCase ) ;
346+ assert . ok ( result , `Should parse: ${ testCase } ` ) ;
347+ } , `Should not throw parsing errors for: ${ testCase } ` ) ;
348+ } ) ;
349+ } ) ;
350+
351+ it ( "should parse @apply with variants and slash notation" , ( ) => {
352+ const testCases = [
353+ "a { @apply hover:bg-blue-500/50; }" ,
354+ "a { @apply focus:outline-ring/30; }" ,
355+ "a { @apply active:border-red-500/25; }" ,
356+ ] ;
357+
358+ testCases . forEach ( ( testCase ) => {
359+ assert . doesNotThrow ( ( ) => {
360+ const result = parse ( testCase ) ;
361+ assert . ok ( result , `Should parse: ${ testCase } ` ) ;
362+ } , `Should not throw parsing errors for: ${ testCase } ` ) ;
363+ } ) ;
364+ } ) ;
365+
366+ it ( "should parse the original issue CSS without errors" , ( ) => {
367+ const originalCSS = `
368+ @layer base {
369+ * {
370+ @apply border-border outline-ring/50;
371+ }
372+ body {
373+ @apply bg-background text-foreground;
374+ }
375+ }
376+ ` ;
377+
378+ // The original issue was that this would throw:
379+ // "Parsing error: Semicolon or block is expected"
380+ // Now it should parse successfully
381+ assert . doesNotThrow ( ( ) => {
382+ const result = parse ( originalCSS ) ;
383+ assert . ok ( result , "Should return a valid AST" ) ;
384+ } , "Should not throw parsing errors" ) ;
385+ } ) ;
335386 } ) ;
336387
337388 describe ( "Validation" , ( ) => {
@@ -340,6 +391,11 @@ describe("Tailwind 3", function () {
340391 "bg-blue-500" ,
341392 "hover:bg-blue-700" ,
342393 "focus:ring-blue-500" ,
394+ "outline-ring/50" ,
395+ "bg-blue-500/30" ,
396+ "border-gray-200/50" ,
397+ "hover:bg-blue-500/50" ,
398+ "focus:outline-ring/30" ,
343399 ] . forEach ( ( value ) => {
344400 it ( `should validate type <tw-apply-ident> with ${ value } ` , ( ) => {
345401 assert . strictEqual ( lexer . matchType ( "tw-apply-ident" , value ) . error , null ) ;
@@ -354,6 +410,9 @@ describe("Tailwind 3", function () {
354410 "bg-blue-500" ,
355411 "hover:bg-blue-700" ,
356412 "bg-blue-500 focus:ring-blue-500" ,
413+ "outline-ring/50" ,
414+ "hover:bg-blue-500/50" ,
415+ "bg-blue-500/30 focus:outline-ring/50" ,
357416 ] . forEach ( ( value ) => {
358417 it ( `should validate @apply ${ value } ` , ( ) => {
359418 assert . strictEqual ( lexer . matchAtrulePrelude ( "apply" , value ) . error , null ) ;
0 commit comments