@@ -28,6 +28,35 @@ describe( 'global styles renderer', () => {
28
28
text : 'red' ,
29
29
} ,
30
30
blocks : {
31
+ 'core/group' : {
32
+ color : {
33
+ background : 'linen' ,
34
+ } ,
35
+ variations : {
36
+ foo : {
37
+ color : 'aliceblue' ,
38
+ blocks : {
39
+ 'core/heading' : {
40
+ typography : {
41
+ fontSize : '3em' ,
42
+ } ,
43
+ } ,
44
+ } ,
45
+ elements : {
46
+ link : {
47
+ color : {
48
+ text : 'darkcyan' ,
49
+ } ,
50
+ ':hover' : {
51
+ color : {
52
+ text : 'darkturqoise' ,
53
+ } ,
54
+ } ,
55
+ } ,
56
+ } ,
57
+ } ,
58
+ } ,
59
+ } ,
31
60
'core/heading' : {
32
61
color : {
33
62
background : 'blue' ,
@@ -89,6 +118,12 @@ describe( 'global styles renderer', () => {
89
118
} ,
90
119
} ;
91
120
const blockSelectors = {
121
+ 'core/group' : {
122
+ selector : '.my-group' ,
123
+ styleVariationSelectors : {
124
+ foo : '.is-style-foo.my-group' ,
125
+ } ,
126
+ } ,
92
127
'core/heading' : {
93
128
selector : '.my-heading1, .my-heading2' ,
94
129
} ,
@@ -129,6 +164,44 @@ describe( 'global styles renderer', () => {
129
164
} ,
130
165
selector : ELEMENTS . link ,
131
166
} ,
167
+ {
168
+ selector :
169
+ '.is-style-foo.my-group .my-heading1, .is-style-foo.my-group .my-heading2' ,
170
+ styles : {
171
+ typography : {
172
+ fontSize : '3em' ,
173
+ } ,
174
+ } ,
175
+ } ,
176
+ {
177
+ selector : '.is-style-foo.my-group a' ,
178
+ styles : {
179
+ color : {
180
+ text : 'darkcyan' ,
181
+ } ,
182
+ ':hover' : {
183
+ color : {
184
+ text : 'darkturqoise' ,
185
+ } ,
186
+ } ,
187
+ } ,
188
+ } ,
189
+ {
190
+ selector : '.my-group' ,
191
+ styles : {
192
+ color : {
193
+ background : 'linen' ,
194
+ } ,
195
+ variations : {
196
+ foo : {
197
+ color : 'aliceblue' ,
198
+ } ,
199
+ } ,
200
+ } ,
201
+ styleVariationSelectors : {
202
+ foo : '.is-style-foo.my-group' ,
203
+ } ,
204
+ } ,
132
205
{
133
206
styles : {
134
207
color : {
@@ -549,6 +622,44 @@ describe( 'global styles renderer', () => {
549
622
} ,
550
623
} ,
551
624
} ,
625
+ 'core/group' : {
626
+ variations : {
627
+ bar : {
628
+ color : {
629
+ background : 'midnightblue' ,
630
+ text : 'lightskyblue' ,
631
+ } ,
632
+ blocks : {
633
+ 'core/heading' : {
634
+ color : {
635
+ text : 'royalblue' ,
636
+ } ,
637
+ } ,
638
+ 'core/image' : {
639
+ border : {
640
+ color : 'darkcyan' ,
641
+ style : 'dashed' ,
642
+ width : '5px' ,
643
+ } ,
644
+ } ,
645
+ } ,
646
+ elements : {
647
+ h2 : {
648
+ color : {
649
+ text : 'turquoise' ,
650
+ } ,
651
+ } ,
652
+ button : {
653
+ color : {
654
+ background : 'midnightblue' ,
655
+ text : 'powderblue' ,
656
+ } ,
657
+ ':hover' : { } ,
658
+ } ,
659
+ } ,
660
+ } ,
661
+ } ,
662
+ } ,
552
663
} ,
553
664
} ,
554
665
} ;
@@ -567,11 +678,21 @@ describe( 'global styles renderer', () => {
567
678
foo : '.is-style-foo.wp-image' ,
568
679
} ,
569
680
} ,
681
+ 'core/group' : {
682
+ selector : '.wp-group' ,
683
+ styleVariationSelectors : {
684
+ bar : '.is-style-bar.wp-group' ,
685
+ } ,
686
+ } ,
687
+ 'core/heading' : {
688
+ selector : '.wp-heading' ,
689
+ } ,
570
690
} ;
571
691
572
692
expect ( toStyles ( Object . freeze ( tree ) , blockSelectors ) ) . toEqual (
573
693
'body {margin: 0;}body .is-layout-flow > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-flow > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-flow > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignleft { float: left; margin-inline-start: 0; margin-inline-end: 2em; }body .is-layout-constrained > .alignright { float: right; margin-inline-start: 2em; margin-inline-end: 0; }body .is-layout-constrained > .aligncenter { margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > :where(:not(.alignleft):not(.alignright):not(.alignfull)) { max-width: var(--wp--style--global--content-size); margin-left: auto !important; margin-right: auto !important; }body .is-layout-constrained > .alignwide { max-width: var(--wp--style--global--wide-size); }body .is-layout-flex { display:flex; }body .is-layout-flex { flex-wrap: wrap; align-items: center; }body .is-layout-flex > * { margin: 0; }body .is-layout-grid { display:grid; }body .is-layout-grid > * { margin: 0; }' +
574
694
'.is-style-foo.wp-image.wp-image-spacing{padding-top: 2px;}.is-style-foo.wp-image.wp-image-border-color{border-color: blue;}.is-style-foo.wp-image{color: blue;}' +
695
+ '.is-style-bar.wp-group .wp-heading{color: royalblue;}.is-style-bar.wp-group .wp-image-border-color{border-color: darkcyan;}.is-style-bar.wp-group .wp-image-border{border-style: dashed;border-width: 5px;}.is-style-bar.wp-group h2{color: turquoise;}.is-style-bar.wp-group .wp-element-button, .is-style-bar.wp-group .wp-block-button__link{color: powderblue;background-color: midnightblue;}.is-style-bar.wp-group{color: lightskyblue;background-color: midnightblue;}' +
575
696
'.wp-site-blocks > .alignleft { float: left; margin-right: 2em; }.wp-site-blocks > .alignright { float: right; margin-left: 2em; }.wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }'
576
697
) ;
577
698
} ) ;
0 commit comments