## Summary - add the RBAC role definition diff UX upgrade as the first concrete consumer of the shared diff presentation foundation - refine managed tenant onboarding draft routing, CTA labeling, and cancellation redirect behavior - tighten related Filament and diff rendering regression coverage ## Testing - updated focused Pest coverage for onboarding draft routing and lifecycle behavior - updated focused Pest coverage for shared diff partials and RBAC finding rendering ## Notes - Livewire v4.0+ compliance is preserved within the existing Filament v5 surfaces - provider registration remains unchanged in bootstrap/providers.php - no new Filament assets were added; existing deployment practice still relies on php artisan filament:assets when assets change Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #171
140 lines
4.5 KiB
PHP
140 lines
4.5 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Diff\DiffRow;
|
|
use App\Support\Diff\DiffRowStatus;
|
|
|
|
it('renders changed rows with shared state labels and from or to values', function (): void {
|
|
$this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'description',
|
|
label: 'Description',
|
|
status: DiffRowStatus::Changed,
|
|
oldValue: 'Before',
|
|
newValue: 'After',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
])
|
|
->assertSee('Changed')
|
|
->assertSee('Description')
|
|
->assertSee('Changed value')
|
|
->assertSee('From')
|
|
->assertSee('Before')
|
|
->assertSee('To')
|
|
->assertSee('After')
|
|
->assertSee('border-warning-200')
|
|
->assertSee('bg-warning-50/70');
|
|
});
|
|
|
|
it('renders added removed and unchanged rows through the shared dispatcher', function (): void {
|
|
$added = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'new_setting',
|
|
label: 'New setting',
|
|
status: DiffRowStatus::Added,
|
|
newValue: 'Enabled',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
$removed = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'retired_setting',
|
|
label: 'Retired setting',
|
|
status: DiffRowStatus::Removed,
|
|
oldValue: 'Legacy',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
$unchanged = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'display_name',
|
|
label: 'Display name',
|
|
status: DiffRowStatus::Unchanged,
|
|
oldValue: 'TenantPilot',
|
|
newValue: 'TenantPilot',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
expect($added)->toContain('Added')
|
|
->and($added)->toContain('Enabled')
|
|
->and($removed)->toContain('Removed')
|
|
->and($removed)->toContain('Legacy')
|
|
->and($unchanged)->toContain('Unchanged')
|
|
->and($unchanged)->toContain('TenantPilot');
|
|
});
|
|
|
|
it('delegates list-like rows to the inline list partial and dims unchanged content when requested', function (): void {
|
|
$listRow = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'scope_tags',
|
|
label: 'Scope tags',
|
|
status: DiffRowStatus::Changed,
|
|
oldValue: ['Default', 'Legacy', 'Shared'],
|
|
newValue: ['Default', 'Shared', 'Workspace'],
|
|
isListLike: true,
|
|
addedItems: ['Workspace'],
|
|
removedItems: ['Legacy'],
|
|
unchangedItems: ['Default', 'Shared'],
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
$unchanged = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'display_name',
|
|
label: 'Display name',
|
|
status: DiffRowStatus::Unchanged,
|
|
oldValue: 'TenantPilot',
|
|
newValue: 'TenantPilot',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
expect($listRow)->toContain('Added items')
|
|
->and($listRow)->toContain('Removed items')
|
|
->and($listRow)->toContain('Unchanged items')
|
|
->and($unchanged)->toContain('text-gray-500')
|
|
->and($unchanged)->toContain('dark:text-gray-400');
|
|
});
|
|
|
|
it('keeps unchanged rows quieter than changed rows while preserving shared state badges', function (): void {
|
|
$changed = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'description',
|
|
label: 'Description',
|
|
status: DiffRowStatus::Changed,
|
|
oldValue: 'Before',
|
|
newValue: 'After',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
$unchanged = (string) $this->view('filament.partials.diff.row', [
|
|
'row' => new DiffRow(
|
|
key: 'display_name',
|
|
label: 'Display name',
|
|
status: DiffRowStatus::Unchanged,
|
|
oldValue: 'TenantPilot',
|
|
newValue: 'TenantPilot',
|
|
),
|
|
'compact' => false,
|
|
'dimUnchanged' => true,
|
|
]);
|
|
|
|
expect($changed)->toContain('border-warning-200')
|
|
->and($changed)->toContain('Changed value')
|
|
->and($unchanged)->toContain('No material change')
|
|
->and($unchanged)->toContain('rounded-xl border border-gray-200 bg-white');
|
|
});
|