TenantAtlas/tests/Feature/Filament/ResolvedReferenceRenderingSmokeTest.php
ahmido d4fb886de0 feat: standardize enterprise detail pages (#162)
## Summary
- introduce a shared enterprise-detail composition layer for Filament detail pages
- migrate BackupSet, BaselineSnapshot, EntraGroup, and OperationRun detail screens to the shared summary-first layout
- add regression and unit coverage for section hierarchy, related context, degraded states, and duplicate fact/badge presentation

## Scope
- adds shared support classes under `app/Support/Ui/EnterpriseDetail`
- adds shared enterprise detail Blade partials under `resources/views/filament/infolists/entries/enterprise-detail`
- updates touched Filament resources/pages to use the shared detail shell
- includes Spec 133 artifacts under `specs/133-detail-page-template`

## Notes
- branch: `133-detail-page-template`
- base: `dev`
- commit: `fd294c7`

Co-authored-by: Ahmed Darrazi <ahmed.darrazi@live.de>
Reviewed-on: #162
2026-03-10 23:06:26 +00:00

96 lines
3.8 KiB
PHP

<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Blade;
it('renders the resolved reference detail partial', function (): void {
$html = Blade::render(
"@include('filament.infolists.entries.resolved-reference-detail', ['reference' => \$reference])",
[
'reference' => [
'primaryLabel' => 'Windows Lockdown',
'secondaryLabel' => 'Version 3',
'stateLabel' => 'Resolved',
'stateColor' => 'success',
'stateIcon' => 'heroicon-m-check-circle',
'stateDescription' => null,
'showStateBadge' => false,
'isLinkable' => true,
'linkTarget' => [
'url' => '/admin/t/1/policy-versions/42',
'actionLabel' => 'View policy version',
'contextBadge' => 'Tenant',
],
'technicalDetail' => [
'displayId' => '42',
'fullId' => '42',
'sourceHint' => 'Captured from drift evidence',
],
],
],
);
expect($html)->toContain('Windows Lockdown')
->and($html)->toContain('Version 3')
->and($html)->not->toContain('Resolved')
->and($html)->toContain('Captured from drift evidence');
});
it('renders related-context actions after badges for both reference and fallback entries', function (): void {
$html = Blade::render(
"@include('filament.infolists.entries.related-context', ['entries' => \$entries])",
[
'entries' => [
[
'label' => 'Run',
'reference' => [
'primaryLabel' => 'Backup set update',
'secondaryLabel' => 'Run #189',
'stateLabel' => 'Resolved',
'stateColor' => 'success',
'stateIcon' => 'heroicon-m-check-circle',
'stateDescription' => null,
'showStateBadge' => false,
'isLinkable' => true,
'linkTarget' => [
'url' => '/admin/operations/189',
'actionLabel' => 'Inspect run',
'contextBadge' => 'Tenant context',
],
'technicalDetail' => [
'displayId' => '189',
'fullId' => '189',
'sourceHint' => null,
],
],
],
[
'label' => 'Operations',
'value' => 'Operations',
'secondaryValue' => 'YPTW2',
'targetUrl' => '/admin/t/demo/operations',
'targetKind' => 'operations',
'availability' => 'available',
'unavailableReason' => null,
'contextBadge' => 'Workspace context',
'priority' => 20,
'actionLabel' => 'Inspect operations',
],
],
],
);
$referenceBadgePosition = strpos($html, 'Tenant context');
$referenceActionPosition = strpos($html, 'Inspect run');
$fallbackBadgePosition = strpos($html, 'Workspace context');
$fallbackActionPosition = strpos($html, 'Inspect operations');
expect($referenceBadgePosition)->not->toBeFalse()
->and($referenceActionPosition)->not->toBeFalse()
->and($fallbackBadgePosition)->not->toBeFalse()
->and($fallbackActionPosition)->not->toBeFalse()
->and($referenceBadgePosition)->toBeLessThan($referenceActionPosition)
->and($fallbackBadgePosition)->toBeLessThan($fallbackActionPosition);
});