Changeset 59925 for trunk/tests/phpunit/tests/blocks/supportedStyles.php
- Timestamp:
- 03/04/2025 01:04:49 PM (2 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.