Files
Toiminnanohjaus/tests/Feature/HomePageTest.php
T
petriandClaude Opus 5.5 7b6a909677 Add light/dark theme toggle remembered in the browser
- New partial resources/views/partials/theme-toggle.blade.php: a Flux
  button that flips $flux.dark. Flux stores the choice in localStorage
  (flux.appearance) and applies it before the page paints; until the
  user chooses, the system theme is followed.
- Shown in the header for signed-in users and at the top right of the
  guest pages.
- Accessible: stable name "Tumma teema" with a tooltip, state in
  aria-pressed, decorative moon/sun icons.
- Browser tests cover toggling, persistence across pages, overriding a
  dark system theme, keyboard use and axe checks in both themes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-22 11:25:01 +02:00

31 lines
896 B
PHP

<?php
use App\Models\User;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Livewire\Livewire;
uses(RefreshDatabase::class);
beforeEach(function () {
$this->actingAs(User::factory()->create(['name' => 'Eero Esimerkki']));
});
it('renders the home page with the main menu', function () {
$this->get(route('home'))
->assertOk()
->assertSee('Toiminnanohjaus')
->assertSee('Siirry pääsisältöön')
->assertSee('id="main-content"', false)
->assertSee('aria-label="Päävalikko"', false)
->assertSee('Kirjautuneena: Eero Esimerkki')
->assertSee('aria-label="Tumma teema"', false);
});
it('increments the click count', function () {
Livewire::test('pages::home')
->assertSet('clickCount', 0)
->call('incrementClickCount')
->assertSet('clickCount', 1)
->assertSee('Klikattu 1 kertaa');
});