Schnellzugriffe mit Logo, Kategorien und Sichtbar für (0.51.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m7s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m30s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 8m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m21s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 17m13s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 17m12s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m52s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m29s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m23s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 7m7s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 7m30s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 8m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 8m21s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 17m13s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 17m12s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m52s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m29s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 47s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m23s
Untertitel, Logo, Kategorie, Rollen und Anheften je Eintrag; Knopf „Anwendungen“ in der Kopfzeile mit allen sichtbaren Einträgen. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
25fe5e8c37
commit
a618927a52
152 changed files with 653 additions and 379 deletions
|
|
@ -3,8 +3,10 @@
|
|||
namespace Tests\Feature\Admin;
|
||||
|
||||
use App\Filament\Pages\QuickLinksSettings;
|
||||
use App\Models\Role;
|
||||
use App\Models\User;
|
||||
use App\Support\QuickLinks;
|
||||
use App\Support\Settings;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Livewire\Livewire;
|
||||
use Tests\TestCase;
|
||||
|
|
@ -48,4 +50,52 @@ class QuickLinksSettingsTest extends TestCase
|
|||
$this->actingAs(User::factory()->create())->get('/admin/startseite-menue/schnellzugriffe')->assertForbidden();
|
||||
$this->actingAs(User::factory()->admin()->create())->get('/admin/startseite-menue/schnellzugriffe')->assertOk();
|
||||
}
|
||||
|
||||
public function test_links_can_be_limited_to_roles_and_pinned(): void
|
||||
{
|
||||
$admin = User::factory()->admin()->create();
|
||||
$clients = Role::create(['name' => 'Klienten']);
|
||||
$this->actingAs($admin);
|
||||
|
||||
Livewire::test(QuickLinksSettings::class)
|
||||
->fillForm(['links' => [
|
||||
['label' => 'Vivendi PEP', 'subtitle' => 'Dienstplan', 'url' => 'https://pep.example.com', 'icon' => 'calendar', 'category' => 'Pflege', 'roles' => [], 'pinned' => true, 'new_tab' => true],
|
||||
['label' => 'DocuWare', 'subtitle' => 'Archiv', 'url' => 'https://docuware.example.com', 'icon' => 'archive', 'category' => 'Verwaltung', 'roles' => [], 'pinned' => false, 'new_tab' => true],
|
||||
['label' => 'Werkstattrat', 'url' => '/seiten/werkstattrat', 'icon' => 'users', 'roles' => [(string) $clients->id], 'pinned' => false, 'new_tab' => false],
|
||||
]])
|
||||
->call('save')
|
||||
->assertHasNoFormErrors();
|
||||
|
||||
$stored = app(QuickLinks::class)->all();
|
||||
$this->assertSame('Dienstplan', $stored[0]['subtitle']);
|
||||
$this->assertSame('Pflege', $stored[0]['category']);
|
||||
$this->assertSame([$clients->id], $stored[2]['roles']);
|
||||
|
||||
// Personen ohne die Rolle sehen den eingeschränkten Eintrag nicht
|
||||
$employee = User::factory()->create();
|
||||
$this->assertSame(['Vivendi PEP', 'DocuWare'], array_column(app(QuickLinks::class)->forUser($employee), 'label'));
|
||||
|
||||
$client = User::factory()->create();
|
||||
$client->roles()->attach($clients);
|
||||
$this->assertContains('Werkstattrat', array_column(app(QuickLinks::class)->forUser($client), 'label'));
|
||||
|
||||
// Startseite: nur angeheftete, dazu die Gesamtzahl für „Alle Anwendungen“
|
||||
$widget = $this->dashboardWidget($this->actingAs($employee)->get('/'), 'core.quick-links');
|
||||
$this->assertSame(['Vivendi PEP'], array_column($widget['links'], 'label'));
|
||||
$this->assertSame(2, $widget['total']);
|
||||
|
||||
// Kopfzeile: alle sichtbaren
|
||||
$this->actingAs($employee)->get('/')->assertInertia(fn ($page) => $page->has('apps', 2));
|
||||
}
|
||||
|
||||
public function test_quick_link_widget_disappears_without_visible_links(): void
|
||||
{
|
||||
$role = Role::create(['name' => 'Verwaltung']);
|
||||
app(Settings::class)->set('portal.quick_links', [
|
||||
['label' => 'Nur Verwaltung', 'url' => 'https://x.example.com', 'icon' => 'link', 'roles' => [$role->id]],
|
||||
]);
|
||||
|
||||
$response = $this->actingAs(User::factory()->create())->get('/');
|
||||
$this->assertNull($this->dashboardWidget($response, 'core.quick-links'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue