diff --git a/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php b/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php index 5c9fc8af5819d..386d2a0041159 100644 --- a/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php +++ b/tests/phpunit/tests/block-supports/wpRenderElementsSupportStyles.php @@ -22,6 +22,7 @@ public function tear_down() { * * @ticket 59555 * @ticket 60557 + * @ticket 65538 * * @covers ::wp_render_elements_support_styles * @@ -185,6 +186,22 @@ public function data_elements_block_support_styles() { ), 'expected_styles' => '/^.wp-elements-\d+ .wp-element-button, .wp-elements-\d+ .wp-block-button__link' . $color_css_rules . '$/', ), + 'button hover styles are skipped without a hover selector' => array( + 'color_settings' => array( 'button' => true ), + 'elements_styles' => array( + 'button' => array( + 'color' => $color_styles, + ':hover' => array( 'color' => $color_styles ), + ), + ), + + /* + * Only the base button rule should be emitted. The button element + * type has no `hover_selector`, so the `:hover` object must be + * ignored rather than triggering an undefined array key warning. + */ + 'expected_styles' => '/^.wp-elements-\d+ .wp-element-button, .wp-elements-\d+ .wp-block-button__link' . $color_css_rules . '$/', + ), 'link element styles are applied' => array( 'color_settings' => array( 'link' => true ), 'elements_styles' => array(