Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
titouanmathis committed Mar 8, 2024
1 parent 7117411 commit 7d3521b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/Managers/AssetsManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
*/
class AssetsManagerTest extends WP_UnitTestCase
{
public AssetsManager $assets_manager;

public function set_up():void
{
parent::set_up();
Expand Down Expand Up @@ -94,4 +96,15 @@ public function test_entries_are_enqueued_by_template()
$this->assertTrue(in_array('theme-editor', wp_styles()->queue, true));
$this->assertTrue(in_array('theme-post', wp_styles()->queue, true));
}


public function test_entries_are_enqeued_by_method() {
$this->assets_manager->enqueue_script( 'method-app', 'app.js' );
$this->assertTrue(in_array('theme-method-app', wp_scripts()->queue, true));
$this->assertTrue(str_ends_with(wp_scripts()->query('theme-method-app')->src, '/app.1234.js'));

$this->assets_manager->enqueue_style( 'method-styles', 'styles.css' );
$this->assertTrue(in_array('theme-method-styles', wp_styles()->queue, true));
$this->assertTrue(str_ends_with(wp_styles()->query('theme-method-styles')->src, '/styles.1234.css'));
}
}

0 comments on commit 7d3521b

Please sign in to comment.