@@ -655,7 +655,7 @@ describe('using apply with the prefix option', () => {
655655 } ,
656656 ] )
657657
658- return run ( input , config , ( ) => processPlugins ( corePlugins ( config ) , config ) ) . then ( result => {
658+ return run ( input , config ) . then ( result => {
659659 expect ( result . css ) . toMatchCss ( expected )
660660 expect ( result . warnings ( ) . length ) . toBe ( 0 )
661661 } )
@@ -679,7 +679,7 @@ describe('using apply with the prefix option', () => {
679679 } ,
680680 ] )
681681
682- return run ( input , config , ( ) => processPlugins ( corePlugins ( config ) , config ) ) . then ( result => {
682+ return run ( input , config ) . then ( result => {
683683 expect ( result . css ) . toMatchCss ( expected )
684684 expect ( result . warnings ( ) . length ) . toBe ( 0 )
685685 } )
@@ -697,7 +697,7 @@ describe('using apply with the prefix option', () => {
697697 } ,
698698 ] )
699699
700- return run ( input , config , ( ) => processPlugins ( corePlugins ( config ) , config ) ) . catch ( e => {
700+ return run ( input , config ) . catch ( e => {
701701 expect ( e ) . toMatchObject ( { name : 'CssSyntaxError' } )
702702 } )
703703 } )
@@ -720,7 +720,7 @@ describe('using apply with the prefix option', () => {
720720 } ,
721721 ] )
722722
723- return run ( input , config , ( ) => processPlugins ( corePlugins ( config ) , config ) ) . then ( result => {
723+ return run ( input , config ) . then ( result => {
724724 expect ( result . css ) . toMatchCss ( expected )
725725 expect ( result . warnings ( ) . length ) . toBe ( 0 )
726726 } )
@@ -744,7 +744,7 @@ describe('using apply with the prefix option', () => {
744744 } ,
745745 ] )
746746
747- return run ( input , config , ( ) => processPlugins ( corePlugins ( config ) , config ) ) . then ( result => {
747+ return run ( input , config ) . then ( result => {
748748 expect ( result . css ) . toMatchCss ( expected )
749749 expect ( result . warnings ( ) . length ) . toBe ( 0 )
750750 } )
@@ -764,16 +764,62 @@ describe('using apply with the prefix option', () => {
764764
765765 expect . assertions ( 1 )
766766
767- return run ( input , config , ( ) => processPlugins ( corePlugins ( config ) , config ) ) . catch ( e => {
767+ return run ( input , config ) . catch ( e => {
768768 expect ( e ) . toMatchObject ( {
769769 name : 'CssSyntaxError' ,
770770 reason : 'The `mt-4` class does not exist, but `tw-mt-4` does. Did you forget the prefix?' ,
771771 } )
772772 } )
773773 } )
774+
775+ test ( 'you can apply classes with important and a prefix enabled' , ( ) => {
776+ const input = `
777+ .foo { @apply tw-mt-4; }
778+ `
779+
780+ const expected = `
781+ .foo { margin-top: 1rem; }
782+ `
783+
784+ const config = resolveConfig ( [
785+ {
786+ ...defaultConfig ,
787+ prefix : 'tw-' ,
788+ important : true ,
789+ } ,
790+ ] )
791+
792+ return run ( input , config ) . then ( result => {
793+ expect ( result . css ) . toMatchCss ( expected )
794+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
795+ } )
796+ } )
797+
798+ test ( 'you can apply classes with an important selector and a prefix enabled' , ( ) => {
799+ const input = `
800+ .foo { @apply tw-mt-4; }
801+ `
802+
803+ const expected = `
804+ .foo { margin-top: 1rem; }
805+ `
806+
807+ const config = resolveConfig ( [
808+ {
809+ ...defaultConfig ,
810+ prefix : 'tw-' ,
811+ important : '#app' ,
812+ } ,
813+ ] )
814+
815+ return run ( input , config ) . then ( result => {
816+ expect ( result . css ) . toMatchCss ( expected )
817+ expect ( result . warnings ( ) . length ) . toBe ( 0 )
818+ } )
819+ } )
774820} )
775821
776- test . skip ( 'you can apply utility classes when a selector is used for the important option' , ( ) => {
822+ test ( 'you can apply utility classes when a selector is used for the important option' , ( ) => {
777823 const input = `
778824 .foo {
779825 @apply mt-8 mb-8;
@@ -794,30 +840,7 @@ test.skip('you can apply utility classes when a selector is used for the importa
794840 } ,
795841 ] )
796842
797- return run ( input , config , processPlugins ( corePlugins ( config ) , config ) . utilities ) . then ( result => {
798- expect ( result . css ) . toMatchCss ( expected )
799- expect ( result . warnings ( ) . length ) . toBe ( 0 )
800- } )
801- } )
802-
803- test . skip ( 'you can apply utility classes without using the given prefix even if important (selector) is used' , ( ) => {
804- const input = `
805- .foo { @apply .tw-mt-4 .mb-4; }
806- `
807-
808- const expected = `
809- .foo { margin-top: 1rem; margin-bottom: 1rem; }
810- `
811-
812- const config = resolveConfig ( [
813- {
814- ...defaultConfig ,
815- prefix : 'tw-' ,
816- important : '#app' ,
817- } ,
818- ] )
819-
820- return run ( input , config , processPlugins ( corePlugins ( config ) , config ) . utilities ) . then ( result => {
843+ return run ( input , config ) . then ( result => {
821844 expect ( result . css ) . toMatchCss ( expected )
822845 expect ( result . warnings ( ) . length ) . toBe ( 0 )
823846 } )
0 commit comments