@@ -7,13 +7,15 @@ function css(nodes) {
77}
88
99function processPluginsWithValidConfig ( config ) {
10- return processPlugins ( _ . defaultsDeep ( config , {
11- options : {
12- prefix : '' ,
13- important : false ,
14- separator : ':'
15- }
16- } ) )
10+ return processPlugins (
11+ _ . defaultsDeep ( config , {
12+ options : {
13+ prefix : '' ,
14+ important : false ,
15+ separator : ':' ,
16+ } ,
17+ } )
18+ )
1719}
1820
1921test ( 'plugins can create utilities with object syntax' , ( ) => {
@@ -143,8 +145,8 @@ test('plugins can create utilities with mixed object styles and PostCSS nodes',
143145 addUtilities ( [
144146 {
145147 '.object-fill' : {
146- objectFit : 'fill'
147- }
148+ objectFit : 'fill' ,
149+ } ,
148150 } ,
149151 postcss . rule ( { selector : '.object-contain' } ) . append ( [
150152 postcss . decl ( {
@@ -182,7 +184,7 @@ test('plugins can create utilities with mixed object styles and PostCSS nodes',
182184test ( 'plugins can create utilities with variants' , ( ) => {
183185 const [ components , utilities ] = processPluginsWithValidConfig ( {
184186 plugins : [
185- function ( { rule , addUtilities } ) {
187+ function ( { addUtilities } ) {
186188 addUtilities (
187189 {
188190 '.object-fill' : {
@@ -283,6 +285,19 @@ test('plugins can create components with raw PostCSS nodes', () => {
283285 } ,
284286 ] ,
285287 } )
288+
289+ expect ( utilities . length ) . toBe ( 0 )
290+ expect ( css ( components ) ) . toMatchCss ( `
291+ .btn-blue {
292+ background-color: blue;
293+ color: white;
294+ padding: .5rem 1rem;
295+ border-radius: .25rem
296+ }
297+ .btn-blue:hover {
298+ background-color: darkblue
299+ }
300+ ` )
286301} )
287302
288303test ( 'plugins can create components with mixed object styles and raw PostCSS nodes' , ( ) => {
@@ -310,8 +325,8 @@ test('plugins can create components with mixed object styles and raw PostCSS nod
310325 ] ) ,
311326 {
312327 '.btn-blue:hover' : {
313- backgroundColor : 'darkblue'
314- }
328+ backgroundColor : 'darkblue' ,
329+ } ,
315330 } ,
316331 ] )
317332 } ,
@@ -422,15 +437,15 @@ test('plugins can access the current config', () => {
422437 {
423438 '.container' : {
424439 width : '100%' ,
425- }
440+ } ,
426441 } ,
427442 ]
428443
429444 _ . forEach ( config ( 'screens' ) , breakpoint => {
430445 containerClasses . push ( {
431446 [ `@media (min-width: ${ breakpoint } )` ] : {
432447 '.container' : { maxWidth : breakpoint } ,
433- }
448+ } ,
434449 } )
435450 } )
436451
@@ -499,7 +514,7 @@ test('plugins can provide fallbacks to keys missing from the config', () => {
499514test ( 'variants are optional when adding utilities' , ( ) => {
500515 const [ , utilities ] = processPluginsWithValidConfig ( {
501516 plugins : [
502- function ( { rule , addUtilities } ) {
517+ function ( { addUtilities } ) {
503518 addUtilities ( {
504519 '.border-collapse' : {
505520 'border-collapse' : 'collapse' ,
@@ -578,7 +593,7 @@ test('plugins can add multiple sets of utilities and components', () => {
578593test ( 'plugins respect prefix and important options by default when adding utilities' , ( ) => {
579594 const [ , utilities ] = processPluginsWithValidConfig ( {
580595 plugins : [
581- function ( { utility , addUtilities } ) {
596+ function ( { addUtilities } ) {
582597 addUtilities ( {
583598 '.rotate-90' : {
584599 transform : 'rotate(90deg)' ,
@@ -673,14 +688,17 @@ test("plugins can apply the user's chosen prefix to components manually", () =>
673688test ( 'prefix can optionally be ignored for utilities' , ( ) => {
674689 const [ , utilities ] = processPluginsWithValidConfig ( {
675690 plugins : [
676- function ( { utility, addUtilities } ) {
677- addUtilities ( {
678- '.rotate-90' : {
679- transform : 'rotate(90deg)' ,
691+ function ( { addUtilities } ) {
692+ addUtilities (
693+ {
694+ '.rotate-90' : {
695+ transform : 'rotate(90deg)' ,
696+ } ,
680697 } ,
681- } , {
682- respectPrefix : false
683- } )
698+ {
699+ respectPrefix : false ,
700+ }
701+ )
684702 } ,
685703 ] ,
686704 options : {
@@ -701,14 +719,17 @@ test('prefix can optionally be ignored for utilities', () => {
701719test ( 'important can optionally be ignored for utilities' , ( ) => {
702720 const [ , utilities ] = processPluginsWithValidConfig ( {
703721 plugins : [
704- function ( { utility, addUtilities } ) {
705- addUtilities ( {
706- '.rotate-90' : {
707- transform : 'rotate(90deg)' ,
722+ function ( { addUtilities } ) {
723+ addUtilities (
724+ {
725+ '.rotate-90' : {
726+ transform : 'rotate(90deg)' ,
727+ } ,
708728 } ,
709- } , {
710- respectImportant : false
711- } )
729+ {
730+ respectImportant : false ,
731+ }
732+ )
712733 } ,
713734 ] ,
714735 options : {
@@ -729,16 +750,19 @@ test('important can optionally be ignored for utilities', () => {
729750test ( 'variants can still be specified when ignoring prefix and important options' , ( ) => {
730751 const [ , utilities ] = processPluginsWithValidConfig ( {
731752 plugins : [
732- function ( { utility, addUtilities } ) {
733- addUtilities ( {
734- '.rotate-90' : {
735- transform : 'rotate(90deg)' ,
753+ function ( { addUtilities } ) {
754+ addUtilities (
755+ {
756+ '.rotate-90' : {
757+ transform : 'rotate(90deg)' ,
758+ } ,
736759 } ,
737- } , {
738- variants : [ 'responsive' , 'hover' , 'focus' ] ,
739- respectImportant : false ,
740- respectPrefix : false ,
741- } )
760+ {
761+ variants : [ 'responsive' , 'hover' , 'focus' ] ,
762+ respectImportant : false ,
763+ respectPrefix : false ,
764+ }
765+ )
742766 } ,
743767 ] ,
744768 options : {
0 commit comments