File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change @@ -451,6 +451,61 @@ test('media queries can be defined multiple times using objects-in-array syntax'
451451 ` )
452452} )
453453
454+ test ( 'plugins can create nested rules' , ( ) => {
455+ const [ components , utilities ] = processPluginsWithValidConfig ( {
456+ plugins : [
457+ function ( { addComponents } ) {
458+ addComponents ( {
459+ '.btn-blue' : {
460+ backgroundColor : 'blue' ,
461+ color : 'white' ,
462+ padding : '.5rem 1rem' ,
463+ borderRadius : '.25rem' ,
464+ '&:hover' : {
465+ backgroundColor : 'darkblue' ,
466+ } ,
467+ '@media (min-width: 500px)' : {
468+ '&:hover' : {
469+ backgroundColor : 'orange' ,
470+ } ,
471+ } ,
472+ '> a' : {
473+ color : 'red' ,
474+ } ,
475+ 'h1 &' : {
476+ color : 'purple' ,
477+ }
478+ } ,
479+ } )
480+ } ,
481+ ] ,
482+ } )
483+
484+ expect ( utilities . length ) . toBe ( 0 )
485+ expect ( css ( components ) ) . toMatchCss ( `
486+ .btn-blue {
487+ background-color: blue;
488+ color: white;
489+ padding: .5rem 1rem;
490+ border-radius: .25rem;
491+ }
492+ .btn-blue:hover {
493+ background-color: darkblue;
494+ }
495+ @media (min-width: 500px) {
496+ .btn-blue:hover {
497+ background-color: orange;
498+ }
499+ }
500+ .btn-blue > a {
501+ color: red;
502+ }
503+ h1 .btn-blue {
504+ color: purple;
505+ }
506+ ` )
507+ } )
508+
454509test ( 'plugins can create rules with escaped selectors' , ( ) => {
455510 const config = {
456511 plugins : [
You can’t perform that action at this time.
0 commit comments