Skip to content

Commit 3249329

Browse files
committed
Theme JSON tests - now that blocks support backgrounds from theme JSON
1 parent 1bbfdd6 commit 3249329

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

phpunit/class-wp-theme-json-test.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4793,14 +4793,14 @@ public function test_get_shadow_styles_for_blocks() {
47934793
$this->assertSame( $expected_styles, $theme_json->get_stylesheet() );
47944794
}
47954795

4796-
public function test_get_top_level_background_image_styles() {
4796+
public function test_get_top_level_and_block_background_image_styles() {
47974797
$theme_json = new WP_Theme_JSON_Gutenberg(
47984798
array(
47994799
'version' => WP_Theme_JSON_Gutenberg::LATEST_SCHEMA,
48004800
'styles' => array(
48014801
'background' => array(
48024802
'backgroundImage' => array(
4803-
'url' => 'http://example.org/image.png',
4803+
'url' => 'http://example.org/body.png',
48044804
),
48054805
'backgroundSize' => 'contain',
48064806
'backgroundRepeat' => 'no-repeat',
@@ -4810,7 +4810,7 @@ public function test_get_top_level_background_image_styles() {
48104810
'core/paragraph' => array(
48114811
'background' => array(
48124812
'backgroundImage' => array(
4813-
'url' => 'http://example.org/image.png',
4813+
'url' => 'http://example.org/paragraph.png',
48144814
'source' => 'file',
48154815
),
48164816
'backgroundSize' => 'cover',
@@ -4823,7 +4823,7 @@ public function test_get_top_level_background_image_styles() {
48234823
'button' => array(
48244824
'background' => array(
48254825
'backgroundImage' => array(
4826-
'url' => 'http://example.org/image.png',
4826+
'url' => 'http://example.org/button.png',
48274827
),
48284828
'backgroundSize' => 'cover',
48294829
'backgroundRepeat' => 'no-repeat',
@@ -4835,7 +4835,7 @@ public function test_get_top_level_background_image_styles() {
48354835
)
48364836
);
48374837

4838-
$expected_styles = "body { margin: 0; }.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; }:where(.is-layout-flex){gap: 0.5em;}:where(.is-layout-grid){gap: 0.5em;}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;}html{min-height: calc(100% - var(--wp-admin--admin-bar--height, 0px));}:where(body){background-image: url('http://example.org/image.png');background-position: center center;background-repeat: no-repeat;background-size: contain;}";
4838+
$expected_styles = "body { margin: 0; }.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; }:where(.is-layout-flex){gap: 0.5em;}:where(.is-layout-grid){gap: 0.5em;}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;}html{min-height: calc(100% - var(--wp-admin--admin-bar--height, 0px));}:where(body){background-image: url('http://example.org/body.png');background-position: center center;background-repeat: no-repeat;background-size: contain;}:where(.wp-element-button, .wp-block-button__link){background-image: url('http://example.org/button.png');background-position: center center;background-repeat: no-repeat;background-size: cover;}:where(p){background-image: url('http://example.org/paragraph.png');background-position: center center;background-repeat: no-repeat;background-size: cover;}";
48394839
$this->assertSame( $expected_styles, $theme_json->get_stylesheet(), 'Styles returned from "::get_stylesheet()" with top-level background styles type does not match expectations' );
48404840

48414841
$theme_json = new WP_Theme_JSON_Gutenberg(

0 commit comments

Comments
 (0)