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]>
69 lines
3.0 KiB
PHP
69 lines
3.0 KiB
PHP
<?php
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
const THEME_TOGGLE = '[data-theme-toggle]';
|
|
|
|
it('switches to the dark theme and back, and remembers the choice', function () {
|
|
$page = visit(route('login'))->on()->desktop()->inLightMode();
|
|
|
|
$page->assertScript('document.documentElement.classList.contains("dark")', false)
|
|
->assertAttribute(THEME_TOGGLE, 'aria-pressed', 'false')
|
|
->assertAttribute(THEME_TOGGLE, 'aria-label', 'Tumma teema')
|
|
->click(THEME_TOGGLE)
|
|
->assertScript('document.documentElement.classList.contains("dark")', true)
|
|
->assertAttribute(THEME_TOGGLE, 'aria-pressed', 'true')
|
|
->assertAttribute(THEME_TOGGLE, 'aria-label', 'Tumma teema')
|
|
->assertScript('localStorage.getItem("dark-theme")', 'dark')
|
|
->assertNoAccessibilityIssues(level: 2);
|
|
|
|
$page->navigate(route('password.request'))
|
|
->assertScript('document.documentElement.classList.contains("dark")', true)
|
|
->click(THEME_TOGGLE)
|
|
->assertScript('document.documentElement.classList.contains("dark")', false)
|
|
->assertScript('localStorage.getItem("dark-theme")', 'light')
|
|
->assertNoAccessibilityIssues(level: 2);
|
|
});
|
|
|
|
it('overrides a dark system theme', function () {
|
|
visit(route('login'))->inDarkMode()
|
|
->assertScript('document.documentElement.classList.contains("dark")', true)
|
|
->assertAttribute(THEME_TOGGLE, 'aria-pressed', 'true')
|
|
->click(THEME_TOGGLE)
|
|
->assertScript('document.documentElement.classList.contains("dark")', false)
|
|
->assertScript('localStorage.getItem("dark-theme")', 'light');
|
|
});
|
|
|
|
it('keeps the chosen theme when moving between pages with wire:navigate', function () {
|
|
$this->actingAs(User::factory()->admin()->create());
|
|
|
|
$page = visit(route('customers.index'))->inLightMode()
|
|
->click(THEME_TOGGLE)
|
|
->assertScript('document.documentElement.classList.contains("dark")', true);
|
|
|
|
$page->click('[aria-controls="nav-group-maintenance"]')
|
|
->click('Käyttäjät')
|
|
->assertPathIs('/users')
|
|
->assertScript('document.documentElement.classList.contains("dark")', true)
|
|
->assertAttribute(THEME_TOGGLE, 'aria-pressed', 'true')
|
|
->click('[aria-controls="nav-group-sales"]')
|
|
->click('Asiakkaat')
|
|
->assertPathIs('/customers')
|
|
->assertScript('document.documentElement.classList.contains("dark")', true)
|
|
->assertAttribute(THEME_TOGGLE, 'aria-pressed', 'true')
|
|
->assertNoAccessibilityIssues(level: 2);
|
|
});
|
|
|
|
it('is in the header for signed-in users and works with the keyboard', function () {
|
|
$this->actingAs(User::factory()->create());
|
|
|
|
visit(route('customers.index'))->inLightMode()
|
|
->assertPresent('header '.THEME_TOGGLE)
|
|
->keys(THEME_TOGGLE, 'Enter')
|
|
->assertScript('document.documentElement.classList.contains("dark")', true)
|
|
->assertScript('localStorage.getItem("dark-theme")', 'dark');
|
|
});
|