Skip to content

Commit

Permalink
chore: add test of active URL in menu
Browse files Browse the repository at this point in the history
  • Loading branch information
alexislefebvre committed Nov 20, 2024
1 parent 2ab21cf commit 232510c
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tests/Controller/PrettyUrls/PrettyUrlsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,17 @@ public function testCustomMainMenuUsesPrettyUrls()
$this->assertSame('http://localhost/second/dashboard/user-editor/custom/path-for-index', $crawler->filter('li.menu-item a:contains("Users")')->attr('href'));
}

public function testCustomMainMenuHasActiveClass()
{
$client = static::createClient();
$client->followRedirects();

$crawler = $client->request('GET', '/admin/pretty/urls/category');

$this->assertStringContainsString('active', $crawler->filter('li.menu-item a:contains("Categories")')->closest('li.menu-item')->attr('class'), 'The “Categories” link must have the active class');
$this->assertStringNotContainsString('active', $crawler->filter('li.menu-item a:contains("Blog Posts")')->closest('li.menu-item')->attr('class'), 'The “Blog Posts” link must not have the active class');
}

public function testDefaultActionsUsePrettyUrls()
{
$client = static::createClient();
Expand Down

0 comments on commit 232510c

Please sign in to comment.