Neues Design: Tailwind + shadcn-vue statt Vuetify/Material 3
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Failing after 1m3s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 1m7s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Failing after 1m16s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Failing after 1m20s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 1m29s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 1m33s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 1m28s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 1m33s
CI / Build-Artefakte aktuell (pull_request) Failing after 52s
- Nüchterne, professionelle Optik: neutrale Flächen, Markenfarbe nur als Akzent, Inter-Schrift (lokal) - Zweizeiliger Header mit Suche, Hauptnavigation und Avatar-Menü - Startseite mit Begrüßungskarte, Schnellzugriffen und „Neu im Team“ - Personenverzeichnis mit Suche, Abteilungsfilter und Seitenaufteilung - Markenfarbe exakt übernommen, Abstufungen serverseitig in OKLCH (ColorPalette) – gemeinsam für Portal und Admin, keine Farbberechnung im Browser - Schnellzugriffe im Admin pflegbar - Filament-Avatare lokal statt über ui-avatars.com (DSGVO) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9c0f8de791
commit
5a3f1f34c7
141 changed files with 3873 additions and 974 deletions
|
|
@ -48,4 +48,12 @@ class AdminAccessTest extends TestCase
|
|||
->get('/')
|
||||
->assertInertia(fn (Assert $page) => $page->where('auth.user.is_admin', true));
|
||||
}
|
||||
|
||||
public function test_backend_does_not_load_avatars_from_third_parties(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->admin()->create())
|
||||
->get('/admin/benutzer')
|
||||
->assertOk()
|
||||
->assertDontSee('ui-avatars.com');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
51
tests/Feature/Admin/QuickLinksSettingsTest.php
Normal file
51
tests/Feature/Admin/QuickLinksSettingsTest.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Filament\Pages\QuickLinksSettings;
|
||||
use App\Models\User;
|
||||
use App\Support\QuickLinks;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
||||
class QuickLinksSettingsTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_admin_can_save_quick_links(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
|
||||
Livewire::test(QuickLinksSettings::class)
|
||||
->fillForm(['links' => [
|
||||
['label' => 'Urlaubsantrag', 'url' => 'https://urlaub.example.com', 'icon' => 'plane', 'new_tab' => true],
|
||||
['label' => 'Personen', 'url' => '/personen', 'icon' => 'users', 'new_tab' => false],
|
||||
]])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$links = app(QuickLinks::class)->all();
|
||||
$this->assertCount(2, $links);
|
||||
$this->assertSame('Urlaubsantrag', $links[0]['label']);
|
||||
$this->assertSame('plane', $links[0]['icon']);
|
||||
}
|
||||
|
||||
public function test_unsafe_urls_are_rejected(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->admin()->create());
|
||||
|
||||
Livewire::test(QuickLinksSettings::class)
|
||||
->fillForm(['links' => [
|
||||
['label' => 'Böse', 'url' => 'javascript:alert(1)', 'icon' => 'link'],
|
||||
]])
|
||||
->call('save')
|
||||
->assertHasFormErrors();
|
||||
}
|
||||
|
||||
public function test_page_is_admin_only(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create())->get('/admin/schnellzugriffe')->assertForbidden();
|
||||
$this->actingAs(User::factory()->admin()->create())->get('/admin/schnellzugriffe')->assertOk();
|
||||
}
|
||||
}
|
||||
72
tests/Feature/DashboardTest.php
Normal file
72
tests/Feature/DashboardTest.php
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class DashboardTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_dashboard_shows_default_quick_links(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->has('quickLinks', 2)
|
||||
->where('quickLinks.0.url', '/personen'));
|
||||
}
|
||||
|
||||
public function test_configured_quick_links_are_sanitized(): void
|
||||
{
|
||||
app(Settings::class)->set('portal.quick_links', [
|
||||
['label' => 'Zeiterfassung', 'url' => 'https://zeit.example.com', 'icon' => 'clock', 'new_tab' => true],
|
||||
['label' => 'Böse', 'url' => 'javascript:alert(1)', 'icon' => 'unbekannt'],
|
||||
]);
|
||||
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->where('quickLinks.0.icon', 'clock')
|
||||
->where('quickLinks.0.new_tab', true)
|
||||
->where('quickLinks.1.url', '#')
|
||||
->where('quickLinks.1.icon', 'link'));
|
||||
}
|
||||
|
||||
public function test_new_colleagues_exclude_self_inactive_and_old_accounts(): void
|
||||
{
|
||||
$me = User::factory()->create();
|
||||
$new = User::factory()->create();
|
||||
User::factory()->inactive()->create();
|
||||
User::factory()->create(['created_at' => now()->subYear()]);
|
||||
|
||||
$this->actingAs($me)
|
||||
->get('/')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->has('newColleagues.data', 1)
|
||||
->where('newColleagues.data.0.id', $new->id)
|
||||
->where('peopleCount', 3));
|
||||
}
|
||||
|
||||
public function test_brand_colors_are_rendered_as_css_variables(): void
|
||||
{
|
||||
app(Settings::class)->set('branding.primary_color', '#E20074');
|
||||
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/')
|
||||
->assertSee('--brand:#E20074', false)
|
||||
->assertSee('--brand-600:#E20074', false)
|
||||
->assertSee('--brand-foreground:#FFFFFF', false);
|
||||
}
|
||||
|
||||
public function test_dark_theme_is_applied_server_side(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create(['theme' => 'dark']))
|
||||
->get('/')
|
||||
->assertSee('class="dark"', false);
|
||||
}
|
||||
}
|
||||
83
tests/Feature/PeopleDirectoryTest.php
Normal file
83
tests/Feature/PeopleDirectoryTest.php
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Inertia\Testing\AssertableInertia as Assert;
|
||||
use Tests\TestCase;
|
||||
|
||||
class PeopleDirectoryTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
public function test_directory_lists_only_active_people(): void
|
||||
{
|
||||
$viewer = User::factory()->create();
|
||||
User::factory()->count(3)->create();
|
||||
User::factory()->inactive()->create(['first_name' => 'Ausgeschieden']);
|
||||
|
||||
$this->actingAs($viewer)
|
||||
->get('/personen')
|
||||
->assertOk()
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->component('People/Index')
|
||||
->where('people.meta.total', 4)
|
||||
->has('people.data', 4));
|
||||
}
|
||||
|
||||
public function test_directory_can_be_searched(): void
|
||||
{
|
||||
$viewer = User::factory()->create(['job_title' => 'Buchhaltung']);
|
||||
User::factory()->create(['first_name' => 'Grete', 'last_name' => 'Müller', 'job_title' => 'Mitarbeitervertretung']);
|
||||
|
||||
$this->actingAs($viewer)
|
||||
->get('/personen?q=vertretung')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->where('people.meta.total', 1)
|
||||
->where('people.data.0.name', 'Grete Müller')
|
||||
->where('filters.q', 'vertretung'));
|
||||
}
|
||||
|
||||
public function test_search_treats_wildcards_literally(): void
|
||||
{
|
||||
$viewer = User::factory()->create();
|
||||
|
||||
$this->actingAs($viewer)
|
||||
->get('/personen?q=%25')
|
||||
->assertInertia(fn (Assert $page) => $page->where('people.meta.total', 0));
|
||||
}
|
||||
|
||||
public function test_directory_can_be_filtered_by_department(): void
|
||||
{
|
||||
$viewer = User::factory()->create(['department' => 'IT']);
|
||||
User::factory()->count(2)->create(['department' => 'Pflege']);
|
||||
|
||||
$this->actingAs($viewer)
|
||||
->get('/personen?abteilung=Pflege')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->where('people.meta.total', 2)
|
||||
->where('departments', ['IT', 'Pflege']));
|
||||
}
|
||||
|
||||
public function test_directory_is_paginated(): void
|
||||
{
|
||||
User::factory()->count(30)->create();
|
||||
|
||||
$this->actingAs(User::query()->first())
|
||||
->get('/personen?page=2')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->where('people.meta.current_page', 2)
|
||||
->has('people.data', 6));
|
||||
}
|
||||
|
||||
public function test_navigation_marks_active_entry(): void
|
||||
{
|
||||
$this->actingAs(User::factory()->create())
|
||||
->get('/personen')
|
||||
->assertInertia(fn (Assert $page) => $page
|
||||
->where('navigation.0.active', false)
|
||||
->where('navigation.1.label', 'Personen')
|
||||
->where('navigation.1.active', true));
|
||||
}
|
||||
}
|
||||
64
tests/Unit/ColorPaletteTest.php
Normal file
64
tests/Unit/ColorPaletteTest.php
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace Tests\Unit;
|
||||
|
||||
use App\Support\ColorPalette;
|
||||
use InvalidArgumentException;
|
||||
use PHPUnit\Framework\Attributes\DataProvider;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class ColorPaletteTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @return array<string, array{string}>
|
||||
*/
|
||||
public static function brandColors(): array
|
||||
{
|
||||
return [
|
||||
'Petrol' => ['#0F4C5C'],
|
||||
'Magenta' => ['#E20074'],
|
||||
'Gelb' => ['#F5C400'],
|
||||
'Blau' => ['#2563EB'],
|
||||
'Grau' => ['#666666'],
|
||||
];
|
||||
}
|
||||
|
||||
#[DataProvider('brandColors')]
|
||||
public function test_brand_color_is_kept_exactly_on_shade_600(string $color): void
|
||||
{
|
||||
$palette = ColorPalette::fromHex($color);
|
||||
|
||||
$this->assertSame([50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950], array_keys($palette));
|
||||
$this->assertSame(strtoupper($color), $palette[600]);
|
||||
|
||||
foreach ($palette as $hex) {
|
||||
$this->assertMatchesRegularExpression('/^#[0-9A-F]{6}$/', $hex);
|
||||
}
|
||||
}
|
||||
|
||||
#[DataProvider('brandColors')]
|
||||
public function test_shades_get_darker_from_50_to_950(string $color): void
|
||||
{
|
||||
$palette = array_values(ColorPalette::fromHex($color));
|
||||
|
||||
for ($i = 1; $i < count($palette); $i++) {
|
||||
$this->assertGreaterThan(
|
||||
ColorPalette::contrast($palette[$i - 1], '#FFFFFF'),
|
||||
ColorPalette::contrast($palette[$i], '#FFFFFF'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_foreground_is_readable(): void
|
||||
{
|
||||
$this->assertSame('#FFFFFF', ColorPalette::foregroundFor('#0F4C5C'));
|
||||
$this->assertSame('#111111', ColorPalette::foregroundFor('#F5C400'));
|
||||
}
|
||||
|
||||
public function test_invalid_colors_are_rejected(): void
|
||||
{
|
||||
$this->expectException(InvalidArgumentException::class);
|
||||
|
||||
ColorPalette::fromHex('rot');
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue