Every UI string now exists in lang/fi and lang/en; a unit test checks that both languages have the same keys and placeholders. A user's language is stored on the account (users.locale) and applied by the SetLocale web middleware, falling back to the session's choice on signed-out pages and then APP_LOCALE. Emails use the user's language through HasLocalePreference, and the login page keeps the language after logout. The header's name, theme toggle and logout button become one profile menu (a disclosure) with the language buttons, light/dark/system theme radios kept on the device, and logging out. Signed-out pages get a Suomi/English switch next to the theme toggle. Co-Authored-By: Claude Opus 5.5 <[email protected]>
31 lines
893 B
PHP
31 lines
893 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('aria-label="Profiili: Eero Esimerkki"', false)
|
|
->assertSee('Kirjaudu ulos');
|
|
});
|
|
|
|
it('increments the click count', function () {
|
|
Livewire::test('pages::home')
|
|
->assertSet('clickCount', 0)
|
|
->call('incrementClickCount')
|
|
->assertSet('clickCount', 1)
|
|
->assertSee('Klikattu 1 kertaa');
|
|
});
|