Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions tests/phpunit/tests/theme/wpThemeJsonResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -1484,4 +1484,32 @@ public function test_block_style_variation_merge_order() {

$this->assertSameSetsWithIndex( $expected, $actual, 'Merged variation styles do not match.' );
}

/**
* Tests that core theme.json does not emit hardcoded button color declarations
* that would override theme styles due to CSS load order.
*
* @covers WP_Theme_JSON_Resolver::get_core_data
* @ticket 65162
*/
public function test_core_theme_json_does_not_set_button_colors() {
$stylesheet = WP_Theme_JSON_Resolver::get_core_data()->get_stylesheet( array( 'styles' ) );

preg_match( '/:root :where\(\.wp-element-button[^{]*\)\s*\{[^}]*\}/', $stylesheet, $matches );
$this->assertNotEmpty( $matches, 'Button element rule should exist in core stylesheet.' );

$button_rule = $matches[0];

$this->assertStringNotContainsString(
'background-color',
$button_rule,
'Core theme.json must not set a background-color on the button element.'
);

$this->assertStringNotContainsString(
'color:',
$button_rule,
'Core theme.json must not set any color property on the button element.'
);
}
}
Loading