@@ -385,6 +385,38 @@ function test_get_stylesheet_skips_disabled_protected_properties() {
385
385
$ this ->assertEquals ( $ expected , $ theme_json ->get_stylesheet ( array ( 'styles ' ) ) );
386
386
}
387
387
388
+ function test_get_stylesheet_skips_top_level_properties_at_block_level () {
389
+ $ theme_json = new WP_Theme_JSON_Gutenberg (
390
+ array (
391
+ 'version ' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA ,
392
+ 'settings ' => array (
393
+ 'spacing ' => array (
394
+ 'padding ' => true ,
395
+ 'blockGap ' => true ,
396
+ ),
397
+ ),
398
+ 'styles ' => array (
399
+ 'spacing ' => array (
400
+ 'padding ' => '1vw ' ,
401
+ 'blockGap ' => '1em ' ,
402
+ ),
403
+ 'blocks ' => array (
404
+ 'core/columns ' => array (
405
+ 'spacing ' => array (
406
+ 'padding ' => '0.5rem ' ,
407
+ 'blockGap ' => '24px ' ,
408
+ ),
409
+ ),
410
+ ),
411
+ ),
412
+ )
413
+ );
414
+
415
+ $ expected = 'body { margin: 0; }body{padding: 1vw;--wp--style--block-gap: 1em;}.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; }.wp-site-blocks > * { margin-block-start: 0; margin-block-end: 0; }.wp-site-blocks > * + * { margin-block-start: var( --wp--style--block-gap ); }.wp-block-columns{padding: 0.5rem;} ' ;
416
+ $ this ->assertEquals ( $ expected , $ theme_json ->get_stylesheet () );
417
+ $ this ->assertEquals ( $ expected , $ theme_json ->get_stylesheet ( array ( 'styles ' ) ) );
418
+ }
419
+
388
420
function test_get_stylesheet_renders_enabled_protected_properties () {
389
421
$ theme_json = new WP_Theme_JSON_Gutenberg (
390
422
array (
@@ -2253,7 +2285,7 @@ function test_sanitization() {
2253
2285
'core/group ' => array (
2254
2286
'spacing ' => array (
2255
2287
'margin ' => 'valid value ' ,
2256
- 'blockGap ' => 'invalid value ' ,
2288
+ 'blockGap ' => 'valid value ' ,
2257
2289
),
2258
2290
),
2259
2291
),
@@ -2271,7 +2303,8 @@ function test_sanitization() {
2271
2303
'blocks ' => array (
2272
2304
'core/group ' => array (
2273
2305
'spacing ' => array (
2274
- 'margin ' => 'valid value ' ,
2306
+ 'margin ' => 'valid value ' ,
2307
+ 'blockGap ' => 'valid value ' ,
2275
2308
),
2276
2309
),
2277
2310
),
0 commit comments