Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only load front end CSS when it is needed #1455

Merged
merged 8 commits into from
Apr 30, 2020
Merged
Prev Previous commit
Next Next commit
Resolve failing tests
  • Loading branch information
jrtashjian committed Apr 30, 2020
commit 544d11fa3c74d75144c4db95efd289ad3a5760e2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class CoBlocks_Generated_Styles_Tests extends WP_UnitTestCase {

private $coblocks_generated_styles;
private $coblocks_block_assets;

private $dimensions;

Expand Down Expand Up @@ -46,6 +47,7 @@ public function setUp() {
];

$this->coblocks_generated_styles = new CoBlocks_Generated_Styles();
$this->coblocks_block_assets = new CoBlocks_Block_Assets();

}

Expand Down Expand Up @@ -105,10 +107,12 @@ public function test_construct_actions() {
*/
public function test_enqueue_styles() {

unset( $GLOBALS['current_screen'] );

$post_id = wp_insert_post(
[
'post_author' => 1,
'post_content' => 'Post content',
'post_content' => '<!-- wp:coblocks/block_with_custom_styles --><!-- /wp:coblocks/block_with_custom_styles -->',
'post_title' => 'Post title',
'post_status' => 'publish',
]
Expand All @@ -121,8 +125,10 @@ public function test_enqueue_styles() {

$post = get_post( $post_id );

$this->coblocks_block_assets->block_assets();
$this->coblocks_generated_styles->enqueue_styles();

do_action( 'enqueue_block_assets' );
do_action( 'wp_enqueue_scripts' );

global $wp_styles;
Expand Down