mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Editor: Some documentation and test improvements for loading separate assets for core blocks:
* Move `should_load_separate_core_block_assets()` to a more appropriate place. * Update DocBlocks and inline comments per the documentation standards. * Document the `$wp_styles` global in `wp_maybe_inline_styles()`. * List the expected result first in unit test assertions. * Remove a duplicate unit test. * Add missing `@covers` tags. Follow-up to [50836], [50837]. See #50328, #52620, #53180. git-svn-id: https://develop.svn.wordpress.org/trunk@50838 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -259,6 +259,7 @@ class WP_Test_Block_Register extends WP_UnitTestCase {
|
||||
|
||||
/**
|
||||
* @ticket 50263
|
||||
* @ticket 50328
|
||||
*/
|
||||
function test_success_register_block_style_handle() {
|
||||
$metadata = array(
|
||||
@@ -307,6 +308,7 @@ class WP_Test_Block_Register extends WP_UnitTestCase {
|
||||
* is found in the fixtures directory.
|
||||
*
|
||||
* @ticket 50263
|
||||
* @ticket 50328
|
||||
*/
|
||||
function test_block_registers_with_metadata_fixture() {
|
||||
$result = register_block_type_from_metadata(
|
||||
|
||||
@@ -422,42 +422,36 @@ CSS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the main "style.css" file gets enqueued when the site doesn't opt-in to separate_core_block_assets.
|
||||
* Tests that the main "style.css" file gets enqueued when the site doesn't opt in to separate core block assets.
|
||||
*
|
||||
* @ticket 50263
|
||||
*
|
||||
* @covers ::wp_default_styles
|
||||
*/
|
||||
function test_common_block_styles_for_viewing_without_split_styles() {
|
||||
function test_block_styles_for_viewing_without_split_styles() {
|
||||
add_filter( 'separate_core_block_assets', '__return_false' );
|
||||
wp_default_styles( $GLOBALS['wp_styles'] );
|
||||
|
||||
$this->assertSame(
|
||||
$GLOBALS['wp_styles']->registered['wp-block-library']->src,
|
||||
'/' . WPINC . '/css/dist/block-library/style.css'
|
||||
'/' . WPINC . '/css/dist/block-library/style.css',
|
||||
$GLOBALS['wp_styles']->registered['wp-block-library']->src
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests that the "common.css" file gets enqueued when the site opts-in to separate_core_block_assets.
|
||||
* Tests that the "common.css" file gets enqueued when the site opts in to separate core block assets.
|
||||
*
|
||||
* @ticket 50263
|
||||
*
|
||||
* @covers ::wp_default_styles
|
||||
*/
|
||||
function test_common_block_styles_for_viewing_with_split_styles() {
|
||||
add_filter( 'separate_core_block_assets', '__return_false' );
|
||||
wp_default_styles( $GLOBALS['wp_styles'] );
|
||||
|
||||
$this->assertSame(
|
||||
$GLOBALS['wp_styles']->registered['wp-block-library']->src,
|
||||
'/' . WPINC . '/css/dist/block-library/style.css'
|
||||
);
|
||||
}
|
||||
|
||||
function test_block_styles_for_viewing_with_split_styles() {
|
||||
add_filter( 'separate_core_block_assets', '__return_true' );
|
||||
wp_default_styles( $GLOBALS['wp_styles'] );
|
||||
|
||||
$this->assertSame(
|
||||
$GLOBALS['wp_styles']->registered['wp-block-library']->src,
|
||||
'/' . WPINC . '/css/dist/block-library/common.css'
|
||||
'/' . WPINC . '/css/dist/block-library/common.css',
|
||||
$GLOBALS['wp_styles']->registered['wp-block-library']->src
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user