WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/21/2020 11:37:30 AM (2 months ago)
Author:
gziolo
Message:

Blocks: Align with Gutenberg the name of generated asset handle for core blocks

Related Gutenberg PR: https://github.com/WordPress/gutenberg/pull/25220.

It aligns with the latest changes added by aristath to the Gutenberg project. As part of styles splitting for core blocks, there was a special pattern introduced for how style handles are named. Ideally, we would apply it to all blocks but there might be some backward compatibility considerations so I left the handling for non-core blocks unchanged.

Props aristath.
See #50328.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/blocks/register.php

    r49603 r49850  
    141141        $this->assertSame(
    142142            'unit-tests-my-block-style',
     143            generate_block_asset_handle( $block_name, 'style' )
     144        );
     145    }
     146
     147    /**
     148     * @ticket 50328
     149     */
     150    function test_generate_block_asset_handle_core_block() {
     151        $block_name = 'core/paragraph';
     152
     153        $this->assertSame(
     154            'wp-block-paragraph-editor',
     155            generate_block_asset_handle( $block_name, 'editorScript' )
     156        );
     157        $this->assertSame(
     158            'wp-block-paragraph',
     159            generate_block_asset_handle( $block_name, 'script' )
     160        );
     161        $this->assertSame(
     162            'wp-block-paragraph-editor',
     163            generate_block_asset_handle( $block_name, 'editorStyle' )
     164        );
     165        $this->assertSame(
     166            'wp-block-paragraph',
    143167            generate_block_asset_handle( $block_name, 'style' )
    144168        );
Note: See TracChangeset for help on using the changeset viewer.