Skip to content

Commit

Permalink
Merge pull request #1604 from hydephp/improved-view-testing
Browse files Browse the repository at this point in the history
Create additional view test method hydephp/develop@dfa603a
  • Loading branch information
github-actions committed Mar 10, 2024
1 parent aa11dd5 commit 6133c6e
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/Unit/Views/NavigationMenuViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,32 @@ public function testNavigationMenuWithDropdownPages()
{
config(['hyde.navigation.subdirectories' => 'dropdown']);

$page = new MarkdownPage('page');
$bar = new MarkdownPage('foo/bar');
$baz = new MarkdownPage('foo/baz');

Hyde::routes()->add($page->getRoute());
Hyde::routes()->add($bar->getRoute());
Hyde::routes()->add($baz->getRoute());

$this->mockRoute($page->getRoute());
$this->mockPage($page);

$contents = $page->compile();

$this->assertStringContainsString('dropdown-container', $contents);
$this->assertStringContainsString('dropdown-button', $contents);

$dropdown = Str::between($contents, '<ul class="dropdown-items', '</ul>');

$this->assertStringContainsString('<a href="foo/bar.html"', $dropdown);
$this->assertStringContainsString('<a href="foo/baz.html"', $dropdown);
}

public function testNavigationMenuWithDropdownPagesWithRootGroupPage()
{
config(['hyde.navigation.subdirectories' => 'dropdown']);

$foo = new MarkdownPage('foo');
$bar = new MarkdownPage('foo/bar');
$baz = new MarkdownPage('foo/baz');
Expand Down

0 comments on commit 6133c6e

Please sign in to comment.