## Summary - add a shared diff presentation layer under `app/Support/Diff` with deterministic row classification, summary derivation, and value stringification - centralize diff-state badge semantics through `BadgeCatalog` with a dedicated `DiffRowStatusBadge` - add reusable Filament diff partials, focused Pest coverage, and the full SpecKit artifact set for spec 141 ## Testing - `vendor/bin/sail artisan test --compact tests/Unit/Support/Diff/DiffRowStatusTest.php tests/Unit/Support/Diff/DiffRowTest.php tests/Unit/Support/Diff/DiffPresenterTest.php tests/Unit/Support/Diff/ValueStringifierTest.php tests/Unit/Badges/DiffRowStatusBadgeTest.php tests/Feature/Support/Diff/SharedDiffSummaryPartialTest.php tests/Feature/Support/Diff/SharedDiffRowPartialTest.php tests/Feature/Support/Diff/SharedInlineListDiffPartialTest.php` - `vendor/bin/sail bin pint --dirty --format agent` ## Filament / Livewire Contract - Livewire v4.0+ compliance: unchanged and respected; this feature adds presentation support only within the existing Filament v5 / Livewire v4 stack - Provider registration: unchanged; no panel/provider changes were required, so `bootstrap/providers.php` remains the correct registration location - Global search: unchanged; no Resource or global-search behavior was added or modified - Destructive actions: none introduced in this feature - Asset strategy: no new registered Filament assets; shared Blade partials rely on the existing asset pipeline and standard deploy step for `php artisan filament:assets` when assets change generally - Testing coverage: presenter, DTOs, stringifier, badge semantics, summary partial, row partial, and inline-list partial are covered by focused Pest unit and feature tests ## Notes - Spec checklist status is complete for `specs/141-shared-diff-presentation-foundation/checklists/requirements.md` - This PR preserves specialized diff renderers and documents incremental adoption rather than forcing migration in the same change Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de> Reviewed-on: #170
33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use App\Support\Badges\BadgeCatalog;
|
|
use App\Support\Badges\BadgeDomain;
|
|
use App\Support\Badges\BadgeSpec;
|
|
use App\Support\Diff\DiffRowStatus;
|
|
|
|
it('maps shared diff row states to canonical badge semantics', function (): void {
|
|
$changed = BadgeCatalog::spec(BadgeDomain::DiffRowStatus, DiffRowStatus::Changed);
|
|
$added = BadgeCatalog::spec(BadgeDomain::DiffRowStatus, DiffRowStatus::Added);
|
|
$removed = BadgeCatalog::spec(BadgeDomain::DiffRowStatus, DiffRowStatus::Removed);
|
|
$unchanged = BadgeCatalog::spec(BadgeDomain::DiffRowStatus, DiffRowStatus::Unchanged);
|
|
|
|
expect($changed->label)->toBe('Changed')
|
|
->and($changed->color)->toBe('warning')
|
|
->and($added->label)->toBe('Added')
|
|
->and($added->color)->toBe('success')
|
|
->and($removed->label)->toBe('Removed')
|
|
->and($removed->color)->toBe('danger')
|
|
->and($unchanged->label)->toBe('Unchanged')
|
|
->and($unchanged->color)->toBe('gray');
|
|
});
|
|
|
|
it('returns a safe unknown badge spec for unsupported diff states', function (): void {
|
|
$spec = BadgeCatalog::spec(BadgeDomain::DiffRowStatus, 'mystery-state');
|
|
|
|
expect($spec)->toBeInstanceOf(BadgeSpec::class)
|
|
->and($spec->label)->toBe('Unknown')
|
|
->and($spec->color)->toBe('gray');
|
|
});
|