Skip to content

Commit

Permalink
fixup! fixup! Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Jan 24, 2024
1 parent b700178 commit a47d17a
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions tests/phpunit/tests/blocks/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,48 @@ public function test_missing_asset_file_register_block_script_handle() {
$this->assertFalse( $result );
}

/**
* @expectedIncorrectUsage register_block_script_handle
* @ticket 60233
*/
public function test_missing_asset_file_register_block_script_module_id() {
$metadata = array(
'file' => __FILE__,
'name' => 'unit-tests/test-block',
'viewScriptModule' => 'file:./blocks/notice/missing-asset.js',
);
$result = register_block_script_module_id( $metadata, 'viewScriptModule' );

$this->assertFalse( $result );
}

/**
* @ticket 60233
*/
public function test_handle_passed_register_block_script_module_id() {
$metadata = array(
'viewScriptModule' => 'test-id',
);
$result = register_block_script_module_id( $metadata, 'viewScriptModule' );

$this->assertSame( 'test-script-handle', $result );
}

/**
* @ticket 60233
*/
public function test_handles_passed_register_block_script_module_ids() {
$metadata = array(
'script' => array( 'test-id', 'test-id-1' ),
);

$result = register_block_script_handle( $metadata, 'viewScriptModule' );
$this->assertSame( 'test-id', $result );

$result = register_block_script_handle( $metadata, 'viewScriptModule', 1 );
$this->assertSame( 'test-id-2', $result, 1 );
}

/**
* @ticket 50263
*/
Expand Down

0 comments on commit a47d17a

Please sign in to comment.