Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add test of active URL in menu #6558

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading