Group the main menu into role-aware popover groups
Replace the flat link row with disclosure groups (Työt, Oma kirjaus, Asiakkaat ja myynti, Hallinto, Ylläpito) built by App\View\MainMenu from Gate abilities, and add menu links for new job, quick sales list and workflow templates. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
|
||||
uses(RefreshDatabase::class);
|
||||
|
||||
beforeEach(function () {
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
});
|
||||
|
||||
it('opens a menu group and closes it with Escape, returning focus to its button', function () {
|
||||
visit(route('home'))->on()->desktop()
|
||||
->assertAttribute('#nav-group-work', 'style', 'display: none;')
|
||||
->click('Työt')
|
||||
->assertAttribute('button[aria-controls="nav-group-work"]', 'aria-expanded', 'true')
|
||||
->assertSee('Pikavastaanotto')
|
||||
->keys('button[aria-controls="nav-group-work"]', 'Escape')
|
||||
->assertAttribute('button[aria-controls="nav-group-work"]', 'aria-expanded', 'false')
|
||||
->assertScript('document.activeElement.getAttribute("aria-controls")', 'nav-group-work');
|
||||
});
|
||||
|
||||
it('has no accessibility issues with a menu group open', function (string $device, string $colorScheme) {
|
||||
$page = visit(route('users.index'));
|
||||
|
||||
$page = $device === 'mobile' ? $page->on()->mobile() : $page->on()->desktop();
|
||||
$page = $colorScheme === 'dark' ? $page->inDarkMode() : $page->inLightMode();
|
||||
|
||||
$page->click('button[aria-controls="nav-group-maintenance"]')
|
||||
->assertSee('Yritystiedot')
|
||||
->assertNoJavaScriptErrors()
|
||||
->assertNoAccessibilityIssues(level: 2);
|
||||
})->with([
|
||||
'desktop, light' => ['desktop', 'light'],
|
||||
'desktop, dark' => ['desktop', 'dark'],
|
||||
'mobile, light' => ['mobile', 'light'],
|
||||
'mobile, dark' => ['mobile', 'dark'],
|
||||
]);
|
||||
Reference in New Issue
Block a user