@@ -744,6 +744,62 @@ test('plugins apply all global variants when variants are configured globally',
744
744
` )
745
745
} )
746
746
747
+ test ( 'plugins can check if corePlugins are enabled' , ( ) => {
748
+ const { components, utilities } = processPlugins (
749
+ [
750
+ function ( { addUtilities, corePlugins } ) {
751
+ addUtilities ( {
752
+ '.test' : {
753
+ 'text-color' : corePlugins ( 'textColor' ) ? 'true' : 'false' ,
754
+ opacity : corePlugins ( 'opacity' ) ? 'true' : 'false' ,
755
+ } ,
756
+ } )
757
+ } ,
758
+ ] ,
759
+ makeConfig ( {
760
+ corePlugins : { textColor : false } ,
761
+ } )
762
+ )
763
+
764
+ expect ( components . length ) . toBe ( 0 )
765
+ expect ( css ( utilities ) ) . toMatchCss ( `
766
+ @variants {
767
+ .test {
768
+ text-color: false;
769
+ opacity: true
770
+ }
771
+ }
772
+ ` )
773
+ } )
774
+
775
+ test ( 'plugins can check if corePlugins are enabled when using array white-listing' , ( ) => {
776
+ const { components, utilities } = processPlugins (
777
+ [
778
+ function ( { addUtilities, corePlugins } ) {
779
+ addUtilities ( {
780
+ '.test' : {
781
+ 'text-color' : corePlugins ( 'textColor' ) ? 'true' : 'false' ,
782
+ opacity : corePlugins ( 'opacity' ) ? 'true' : 'false' ,
783
+ } ,
784
+ } )
785
+ } ,
786
+ ] ,
787
+ makeConfig ( {
788
+ corePlugins : [ 'textColor' ] ,
789
+ } )
790
+ )
791
+
792
+ expect ( components . length ) . toBe ( 0 )
793
+ expect ( css ( utilities ) ) . toMatchCss ( `
794
+ @variants {
795
+ .test {
796
+ text-color: true;
797
+ opacity: false
798
+ }
799
+ }
800
+ ` )
801
+ } )
802
+
747
803
test ( 'plugins can provide fallbacks to keys missing from the config' , ( ) => {
748
804
const { components, utilities } = processPlugins (
749
805
[
0 commit comments