@@ -558,6 +558,97 @@ test('you can apply utilities with multi-class selectors like group-hover varian
558558} )
559559
560560test ( 'you can apply classes recursively' , ( ) => {
561+ const input = `
562+ .baz {
563+ color: blue;
564+ }
565+ .bar {
566+ @apply baz px-4;
567+ }
568+ .foo {
569+ @apply bar;
570+ }
571+ `
572+ const expected = `
573+ .baz {
574+ color: blue;
575+ }
576+ .bar {
577+ padding-left: 1rem;
578+ padding-right: 1rem;
579+ color: blue;
580+ }
581+ .foo {
582+ padding-left: 1rem;
583+ padding-right: 1rem;
584+ color: blue;
585+ }
586+ `
587+
588+ expect . assertions ( 2 )
589+
590+ return run ( input ) . then ( ( result ) => {
591+ expect ( result . css ) . toMatchCss ( expected )
592+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
593+ } )
594+ } )
595+
596+ test . skip ( 'you can apply complex classes recursively' , ( ) => {
597+ const input = `
598+ .button {
599+ @apply rounded-xl px-6 py-2 hover:text-white focus:border-opacity-100;
600+ }
601+
602+ .button-yellow {
603+ @apply button bg-yellow-600 text-gray-200;
604+ }
605+ `
606+ const expected = `
607+ .button:focus {
608+ --tw-border-opacity: 1;
609+ }
610+ .button {
611+ border-radius: 0.75rem;
612+ padding-top: 0.5rem;
613+ padding-bottom: 0.5rem;
614+ padding-left: 1.5rem;
615+ padding-right: 1.5rem;
616+ }
617+ .button:hover {
618+ --tw-text-opacity: 1;
619+ color: rgba(255, 255, 255, var(--tw-text-opacity));
620+ }
621+ .button-yellow:focus {
622+ --tw-border-opacity: 1;
623+ }
624+ .button-yellow {
625+ border-radius: 0.75rem;
626+ padding-top: 0.5rem;
627+ padding-bottom: 0.5rem;
628+ padding-left: 1.5rem;
629+ padding-right: 1.5rem;
630+ }
631+ .button-yellow:hover {
632+ --tw-text-opacity: 1;
633+ color: rgba(255, 255, 255, var(--tw-text-opacity));
634+ }
635+ .button-yellow {
636+ --tw-bg-opacity: 1;
637+ background-color: rgba(217, 119, 6, var(--tw-bg-opacity));
638+ --tw-text-opacity: 1;
639+ color: rgba(229, 231, 235, var(--tw-text-opacity));
640+ }
641+ `
642+
643+ expect . assertions ( 2 )
644+
645+ return run ( input ) . then ( ( result ) => {
646+ expect ( result . css ) . toMatchCss ( expected )
647+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
648+ } )
649+ } )
650+
651+ test ( 'you can apply classes recursively out of order' , ( ) => {
561652 const input = `
562653 .foo {
563654 @apply bar;
0 commit comments