Skip to content

Commit

Permalink
Ensure Navigation block script is registered to fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Jan 25, 2022
1 parent 2517eeb commit 95a3405
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/php/test-class-amp-core-block-handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ public function tearDown() {
if ( did_action( 'add_attachment' ) ) {
$this->remove_added_uploads();
}

global $wp_scripts, $wp_styles;
$wp_scripts = null;
$wp_styles = null;

parent::tearDown();
}

Expand Down Expand Up @@ -563,7 +568,9 @@ public function test_ampify_navigation_block( $block_attrs, $block_markup, $expe
$handler->register_embed();

$script_handle = 'wp-block-navigation-view';
$this->assertTrue( wp_script_is( $script_handle, 'registered' ) );
if ( ! wp_script_is( $script_handle, 'registered' ) ) {
wp_register_script( $script_handle, 'view.js', [], '1.0', true );
}
wp_enqueue_script( $script_handle ); // Normally done by render_block_core_navigation().

$this->assertEqualMarkup(
Expand Down

0 comments on commit 95a3405

Please sign in to comment.