Changeset 57031
- Timestamp:
- 10/31/2023 11:57:35 AM (14 months ago)
- Location:
- branches/6.4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/6.4
-
branches/6.4/src/wp-includes/blocks/index.php
r56785 r57031 107 107 $wp_styles->add_data( $style_handle, 'path', $path ); 108 108 109 $rtl_file = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path );109 $rtl_file = "{$name}/{$filename}-rtl{$suffix}.css"; 110 110 if ( is_rtl() && in_array( $rtl_file, $files, true ) ) { 111 111 $wp_styles->add_data( $style_handle, 'rtl', 'replace' ); 112 112 $wp_styles->add_data( $style_handle, 'suffix', $suffix ); 113 $wp_styles->add_data( $style_handle, 'path', $rtl_file);113 $wp_styles->add_data( $style_handle, 'path', str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $path ) ); 114 114 } 115 115 }; -
branches/6.4/tests/phpunit/tests/blocks/registerCoreBlockStyleHandles.php
r56064 r57031 96 96 $this->assertArrayHasKey( $style_handle, $wp_styles->registered, 'The key should exist, as this style should be registered' ); 97 97 if ( false === $wp_styles->registered[ $style_handle ]->src ) { 98 $this->assertEmpty( $wp_styles->registered[ $style_handle ]->extra, 'If source is false, not style path shouldbe set' );98 $this->assertEmpty( $wp_styles->registered[ $style_handle ]->extra, 'If source is false, style path should not be set' ); 99 99 } else { 100 100 $this->assertStringContainsString( $this->includes_url, $wp_styles->registered[ $style_handle ]->src, 'Source of style should contain the includes url' ); … … 124 124 $this->assertArrayHasKey( $style_handle, $wp_styles->registered, 'The key should exist, as this style should be registered' ); 125 125 if ( false === $wp_styles->registered[ $style_handle ]->src ) { 126 $this->assertEmpty( $wp_styles->registered[ $style_handle ]->extra, 'If source is false, not style path shouldbe set' );126 $this->assertEmpty( $wp_styles->registered[ $style_handle ]->extra, 'If source is false, style path should not be set' ); 127 127 } else { 128 128 $this->assertStringContainsString( $this->includes_url, $wp_styles->registered[ $style_handle ]->src, 'Source of style should contain the includes url' ); … … 130 130 $this->assertArrayHasKey( 'path', $wp_styles->registered[ $style_handle ]->extra, 'The path key of the style should exist in extra array' ); 131 131 $this->assertNotEmpty( $wp_styles->registered[ $style_handle ]->extra['path'], 'The path key of the style should not be empty' ); 132 } 133 } 134 135 /** 136 * @ticket 59715 137 * 138 * @dataProvider data_block_data 139 * 140 * @param string $name The block name. 141 */ 142 public function test_register_core_block_style_handles_should_load_rtl_stylesheets_for_rtl_text_direction( $name ) { 143 global $wp_locale; 144 145 $orig_text_dir = $wp_locale->text_direction; 146 $wp_locale->text_direction = 'rtl'; 147 148 add_filter( 'should_load_separate_core_block_assets', '__return_true' ); 149 register_core_block_style_handles(); 150 151 $wp_styles = $GLOBALS['wp_styles']; 152 153 $style_handle = "wp-block-{$name}-theme"; 154 155 $wp_locale->text_direction = $orig_text_dir; 156 157 $this->assertArrayHasKey( $style_handle, $wp_styles->registered, 'The key should exist, as this style should be registered' ); 158 if ( false === $wp_styles->registered[ $style_handle ]->src ) { 159 $this->assertEmpty( $wp_styles->registered[ $style_handle ]->extra, 'If source is false, style path should not be set' ); 160 } else { 161 $this->assertStringContainsString( $this->includes_url, $wp_styles->registered[ $style_handle ]->src, 'Source of style should contain the includes url' ); 162 $this->assertNotEmpty( $wp_styles->registered[ $style_handle ]->extra, 'The path of the style should exist' ); 163 $this->assertArrayHasKey( 'path', $wp_styles->registered[ $style_handle ]->extra, 'The path key of the style should exist in extra array' ); 164 $this->assertNotEmpty( $wp_styles->registered[ $style_handle ]->extra['path'], 'The path key of the style should not be empty' ); 165 $this->assertArrayHasKey( 'rtl', $wp_styles->registered[ $style_handle ]->extra, 'The rtl key of the style should exist in extra array' ); 132 166 } 133 167 }
Note: See TracChangeset
for help on using the changeset viewer.