diff --git src/wp-includes/post-template.php src/wp-includes/post-template.php
index 0c1d1e4..b81ce44 100644
|
|
|
function get_body_class( $class = '' ) { |
| 711 | 711 | $classes[] = 'no-customize-support'; |
| 712 | 712 | } |
| 713 | 713 | |
| 714 | | if ( get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) || get_background_image() ) |
| | 714 | if ( current_theme_supports( 'custom-background' ) && |
| | 715 | ( |
| | 716 | get_background_color() !== get_theme_support( 'custom-background', 'default-color' ) |
| | 717 | || get_background_image() |
| | 718 | ) |
| | 719 | ) { |
| 715 | 720 | $classes[] = 'custom-background'; |
| | 721 | } |
| 716 | 722 | |
| 717 | 723 | if ( has_custom_logo() ) { |
| 718 | 724 | $classes[] = 'wp-custom-logo'; |
diff --git tests/phpunit/tests/post/getBodyClass.php tests/phpunit/tests/post/getBodyClass.php
index 7401ce6..41c3b3a 100644
|
|
|
class Tests_Post_GetBodyClass extends WP_UnitTestCase { |
| 92 | 92 | $this->assertContains( "single-format-standard", $class ); |
| 93 | 93 | } |
| 94 | 94 | |
| | 95 | /** |
| | 96 | * @ticket 38168 |
| | 97 | */ |
| | 98 | public function test_custom_background_class_is_added_when_theme_supports_it() { |
| | 99 | set_theme_mod( 'background_color', '#000000' ); |
| | 100 | |
| | 101 | $actual = get_body_class(); |
| | 102 | |
| | 103 | set_theme_mod( 'background_color', false ); |
| | 104 | |
| | 105 | $this->assertTrue( current_theme_supports( 'custom-background' ) ); |
| | 106 | $this->assertContains( 'custom-background', $actual ); |
| | 107 | } |
| | 108 | |
| | 109 | /** |
| | 110 | * @ticket 38168 |
| | 111 | */ |
| | 112 | public function test_custom_background_class_is_not_added_when_theme_support_is_missing() { |
| | 113 | set_theme_mod( 'background_color', '#000000' ); |
| | 114 | |
| | 115 | $theme_support = get_theme_support( 'custom-background' ); |
| | 116 | remove_theme_support( 'custom-background' ); |
| | 117 | |
| | 118 | $actual = get_body_class(); |
| | 119 | |
| | 120 | add_theme_support( 'custom-background', $theme_support ); |
| | 121 | set_theme_mod( 'background_color', false ); |
| | 122 | |
| | 123 | $this->assertNotContains( 'custom-background', $actual ); |
| | 124 | } |
| 95 | 125 | } |