Make WordPress Core


Ignore:
Timestamp:
10/04/2023 06:45:16 PM (8 months ago)
Author:
audrasjb
Message:

Editor: Fix loading of assets in blocks in child themes where the directory name starts with the parent theme's directory name.

Props lgladdy, masteradhoc, audrasjb, rajinsharwar, azaozz.
Merges [56527] to the 6.3 branch.
Fixes #59018.

Location:
branches/6.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.3

  • branches/6.3/tests/phpunit/tests/blocks/register.php

    r56044 r56776  
    271271
    272272        $this->assertSame( 'unit-tests-test-block-script', $result );
     273
     274        // Test the behavior directly within the unit test
     275        $this->assertFalse(
     276            strpos(
     277                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['script'] ) ),
     278                trailingslashit( wp_normalize_path( get_template_directory() ) )
     279            ) === 0
     280        );
     281
     282        $this->assertFalse(
     283            strpos(
     284                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['script'] ) ),
     285                trailingslashit( wp_normalize_path( get_stylesheet_directory() ) )
     286            ) === 0
     287        );
    273288    }
    274289
     
    438453            wp_normalize_path( realpath( DIR_TESTDATA . '/blocks/notice/block.css' ) ),
    439454            wp_normalize_path( wp_styles()->get_data( 'unit-tests-test-block-style', 'path' ) )
     455        );
     456
     457        // Test the behavior directly within the unit test
     458        $this->assertFalse(
     459            strpos(
     460                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['style'] ) ),
     461                trailingslashit( wp_normalize_path( get_template_directory() ) )
     462            ) === 0
     463        );
     464
     465        $this->assertFalse(
     466            strpos(
     467                wp_normalize_path( realpath( dirname( $metadata['file'] ) . '/' . $metadata['style'] ) ),
     468                trailingslashit( wp_normalize_path( get_stylesheet_directory() ) )
     469            ) === 0
    440470        );
    441471    }
Note: See TracChangeset for help on using the changeset viewer.