2026-03-19 19:59:08 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MintyPHP\Tests\Architecture;
|
|
|
|
|
|
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
|
|
|
|
|
|
class FilterDrawerRuntimeContractTest extends TestCase
|
|
|
|
|
{
|
|
|
|
|
use ProjectFileAssertionSupport;
|
|
|
|
|
|
|
|
|
|
public function testUsersResetKeepsTenantParam(): void
|
|
|
|
|
{
|
|
|
|
|
$moduleContent = $this->readProjectFile('web/js/pages/admin-users-index.js');
|
|
|
|
|
$this->assertStringContainsString("preserveFilterParams: ['tenant']", $moduleContent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testFilterDrawerAndExperienceImplementFocusTrapAndDirtyApplyUi(): void
|
|
|
|
|
{
|
|
|
|
|
$drawerJs = $this->readProjectFile('web/js/components/app-filter-drawer.js');
|
|
|
|
|
$this->assertStringContainsString("drawer.setAttribute('role', 'dialog')", $drawerJs);
|
|
|
|
|
$this->assertStringContainsString("drawer.setAttribute('aria-modal', 'true')", $drawerJs);
|
2026-04-22 15:22:26 +02:00
|
|
|
// Focus-trap + focus-return implementation moved to shared utility.
|
|
|
|
|
$this->assertStringContainsString("from '../core/app-focus-trap.js'", $drawerJs);
|
|
|
|
|
$this->assertStringContainsString('focusTrap.activate(', $drawerJs);
|
|
|
|
|
$this->assertStringContainsString('focusTrap.deactivate()', $drawerJs);
|
|
|
|
|
|
|
|
|
|
$trapJs = $this->readProjectFile('web/js/core/app-focus-trap.js');
|
|
|
|
|
$this->assertStringContainsString("if (event.key !== 'Tab')", $trapJs);
|
|
|
|
|
$this->assertStringContainsString("lastTrigger && typeof lastTrigger.focus === 'function'", $trapJs);
|
2026-03-19 19:59:08 +01:00
|
|
|
|
|
|
|
|
$experienceJs = $this->readProjectFile('web/js/pages/app-list-filter-experience.js');
|
|
|
|
|
$this->assertStringContainsString('countDraftChanges(', $experienceJs);
|
|
|
|
|
$this->assertStringContainsString('countActiveDraftFilters(', $experienceJs);
|
|
|
|
|
$this->assertStringContainsString('drawerController.setApplyEnabled(changedCount > 0);', $experienceJs);
|
|
|
|
|
$this->assertStringContainsString('drawerController.setApplyCount(activeCount);', $experienceJs);
|
|
|
|
|
$this->assertStringContainsString('announceLive(', $experienceJs);
|
|
|
|
|
|
|
|
|
|
$stateJs = $this->readProjectFile('web/js/pages/app-list-filter-state.js');
|
|
|
|
|
$this->assertStringContainsString('buildChipsFromMeta', $stateJs);
|
|
|
|
|
$this->assertStringContainsString('removeChipFromMetaState', $stateJs);
|
|
|
|
|
$this->assertStringContainsString('clearMetaState', $stateJs);
|
|
|
|
|
}
|
|
|
|
|
}
|