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
  • Loading branch information
caendesilva authored Mar 10, 2024
2 parents 53cc222 + 48a5a10 commit dfa603a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/framework/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 dfa603a

Please sign in to comment.