mirror of
https://github.com/MarijnDoeve/TijdVoorDeTest.git
synced 2026-07-12 21:05:19 +02:00
fix: hide backoffice navbar-toggler when there's nothing to collapse
The toggler button was always rendered, but its collapse target (#navbarSupportedContent) only existed for authenticated users. On the login page, tapping the menu button on a narrow screen did nothing because the target it pointed at wasn't in the DOM.
This commit is contained in:
@@ -19,6 +19,24 @@ final class LoginControllerTest extends AbstractControllerWebTestCase
|
||||
self::assertSelectorExists('form');
|
||||
}
|
||||
|
||||
public function testNavbarTogglerHasNoDeadTargetWhenNotAuthenticated(): void
|
||||
{
|
||||
$this->client->request(Request::METHOD_GET, '/login');
|
||||
|
||||
$crawler = $this->client->getCrawler();
|
||||
$toggler = $crawler->filter('.navbar-toggler');
|
||||
|
||||
if (0 === $toggler->count()) {
|
||||
self::assertSelectorNotExists('#navbarSupportedContent');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$target = $toggler->attr('data-bs-target');
|
||||
$this->assertNotNull($target);
|
||||
self::assertSelectorExists($target);
|
||||
}
|
||||
|
||||
public function testLoginRedirectsToBackofficeWhenAlreadyAuthenticated(): void
|
||||
{
|
||||
$this->loginAs('test@example.org');
|
||||
|
||||
Reference in New Issue
Block a user