Changeset 59925
- Timestamp:
- 03/04/2025 01:04:49 PM (6 weeks ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-block-supports.php
r59093 r59925 182 182 // This is hardcoded on purpose. 183 183 // We only support a fixed list of attributes. 184 $attributes_to_merge = array( 'style', 'class', 'id' );184 $attributes_to_merge = array( 'style', 'class', 'id', 'aria-label' ); 185 185 $attributes = array(); 186 186 foreach ( $attributes_to_merge as $attribute_name ) { -
trunk/src/wp-settings.php
r59837 r59925 388 388 require ABSPATH . WPINC . '/block-supports/background.php'; 389 389 require ABSPATH . WPINC . '/block-supports/block-style-variations.php'; 390 require ABSPATH . WPINC . '/block-supports/aria-label.php'; 390 391 require ABSPATH . WPINC . '/style-engine.php'; 391 392 require ABSPATH . WPINC . '/style-engine/class-wp-style-engine.php'; -
trunk/tests/phpunit/tests/blocks/supportedStyles.php
r57987 r59925 149 149 array_map( 'trim', explode( ';', $style_list ) ), 150 150 'Style list does not match expected styles' 151 ); 152 } 153 154 /** 155 * Runs assertions that the rendered output has expected content and aria-label attr. 156 * 157 * @param array $block Block to render. 158 * @param string $expected_aria_label Expected output aria-label attr string. 159 */ 160 private function assert_content_and_aria_label_match( $block, $expected_aria_label ) { 161 $styled_block = $this->render_example_block( $block ); 162 $content = $this->get_content_from_block( $styled_block ); 163 164 $this->assertSame( self::BLOCK_CONTENT, $content, 'Block content does not match expected content' ); 165 $this->assertSame( 166 $expected_aria_label, 167 $this->get_attribute_from_block( 'aria-label', $styled_block ), 168 'Aria-label does not match expected aria-label' 151 169 ); 152 170 } … … 687 705 688 706 /** 707 * Tests aria-label server-side block support. 708 */ 709 public function test_aria_label_support() { 710 $block_type_settings = array( 711 'attributes' => array(), 712 'supports' => array( 713 'ariaLabel' => true, 714 ), 715 ); 716 $this->register_block_type( 'core/example', $block_type_settings ); 717 718 $block = array( 719 'blockName' => 'core/example', 720 'attrs' => array( 721 'ariaLabel' => 'Label', 722 ), 723 'innerBlock' => array(), 724 'innerContent' => array(), 725 'innerHTML' => array(), 726 ); 727 728 $this->assert_content_and_aria_label_match( $block, 'Label' ); 729 } 730 731 /** 689 732 * Ensures libxml_internal_errors is being used instead of @ warning suppression 690 733 */
Note: See TracChangeset
for help on using the changeset viewer.