Editor: Fix 'wp-block-library-theme' style enqueue conditions.

Fixes the conditions for when to enqueue the opinionated block styles (i.e. `'wp-block-library-theme'` stylesheet):

* the theme adds `'wp-block-styles'` theme support;
* and no editor styles are declared.

This resolves an issue with themes that do not add the `'wp-block-styles'` theme support while not impacting themes that do.

Follow-up to [53419], [52069], [50761], [44157].

Props mikachan, costdev, glendaviesnz, hellofromTonya, jffng, mamaduka, ndiego, poena, sannevndrmeulen, scruffian.
Fixes #57561.

git-svn-id: https://develop.svn.wordpress.org/trunk@55368 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Tonya Mork
2023-02-20 21:11:57 +00:00
parent cd1228df78
commit cdcbfd19f4
4 changed files with 17 additions and 8 deletions

View File

@@ -405,9 +405,9 @@ CSS;
}
/**
* Tests that visual block styles are enqueued in the editor even when there is not theme support for 'wp-block-styles'.
* Tests that visual block styles are not be enqueued in the editor when there is not theme support for 'wp-block-styles'.
*
* Visual block styles should always be enqueued when editing to avoid the appearance of a broken editor.
* @ticket 57561
*
* @covers ::wp_enqueue_style
*/
@@ -419,7 +419,7 @@ CSS;
$this->assertFalse( wp_style_is( 'wp-block-library-theme' ) );
wp_enqueue_style( 'wp-edit-blocks' );
$this->assertTrue( wp_style_is( 'wp-block-library-theme' ) );
$this->assertFalse( wp_style_is( 'wp-block-library-theme' ), "The 'wp-block-library-theme' style should not be in the queue after enqueuing 'wp-edit-blocks'" );
}
/**