I18n: Standardize the script paths for blocks

When providing file paths to scripts (editorScript, script or viewScript), when there is a trailing ./ included then there was a different md5 generated for the file that didn't match the one used with the file generated in the translations folder.

Props Rahe.
See #54797.



git-svn-id: https://develop.svn.wordpress.org/trunk@52699 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Greg Ziółkowski
2022-02-11 12:12:56 +00:00
parent 968b3fc5a4
commit af07f6af4b
2 changed files with 15 additions and 2 deletions

View File

@@ -122,9 +122,18 @@ class Tests_Blocks_Register extends WP_UnitTestCase {
* @ticket 50263
*/
public function test_removes_block_asset_path_prefix() {
$result = remove_block_asset_path_prefix( 'file:block.js' );
$this->assertSame( 'block.js', $result );
}
/**
* @ticket 54797
*/
public function test_removes_block_asset_path_prefix_and_current_directory() {
$result = remove_block_asset_path_prefix( 'file:./block.js' );
$this->assertSame( './block.js', $result );
$this->assertSame( 'block.js', $result );
}
/**