Files
breadcrumb-the-shire/tests/Architecture/FilterDrawerRuntimeContractTest.php

38 lines
1.8 KiB
PHP
Raw Normal View History

<?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);
$this->assertStringContainsString("if (event.key !== 'Tab') {return;}", $drawerJs);
$this->assertStringContainsString('if (lastTrigger && typeof lastTrigger.focus === \'function\'', $drawerJs);
$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);
}
}