Skip to content

Commit

Permalink
Update tests for @menu, @hasmenu, @endhasmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwebca authored Jun 21, 2024
1 parent 6c97152 commit 799af80
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Unit/WordPressTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,33 @@
expect($compiled)->toBe("<?php echo get_theme_mod('mod', 'default'); ?>");
});
});

describe('@menu', function () {
it('compiles correctly', function () {
$directive = "@menu(['theme_location' => 'primary_navigation'])";

$compiled = $this->compile($directive);

expect($compiled)->toBe("<?php wp_nav_menu(['theme_location' => 'primary_navigation']); ?>");
});
});

describe('@hasmenu', function () {
it('compiles correctly', function () {
$directive = "@hasmenu('primary_navigation')";

$compiled = $this->compile($directive);

expect($compiled)->toBe("<?php if (has_nav_menu('primary_navigation')) : ?>");
});
});

describe('@endhasmenu', function () {
it('compiles correctly', function () {
$directive = '@endhasmenu';

$compiled = $this->compile($directive);

expect($compiled)->toBe('<?php endif; ?>');
});
});

0 comments on commit 799af80

Please sign in to comment.