Repo Interface für tests
This commit is contained in:
@@ -8,6 +8,15 @@ class FilterDrawerContractTest extends TestCase
|
||||
{
|
||||
use ProjectFileAssertionSupport;
|
||||
|
||||
private function readTemplatePageModule(string $templateFile): string
|
||||
{
|
||||
$template = $this->readProjectFile($templateFile);
|
||||
$matched = preg_match("/assetVersion\\('js\\/pages\\/([^']+\\.js)'\\)/", $template, $captures);
|
||||
$this->assertSame(1, $matched, $templateFile . ' must reference a page module via assetVersion().');
|
||||
|
||||
return $this->readProjectFile('web/js/pages/' . $captures[1]);
|
||||
}
|
||||
|
||||
private function usesSharedListFiltersPartial(string $content): bool
|
||||
{
|
||||
return str_contains($content, "require templatePath('partials/app-list-filters.phtml');");
|
||||
@@ -38,10 +47,11 @@ class FilterDrawerContractTest extends TestCase
|
||||
{
|
||||
foreach ($this->drawerTemplateFiles() as $file) {
|
||||
$content = $this->readProjectFile($file);
|
||||
$moduleContent = $this->readTemplatePageModule($file);
|
||||
$usesPartial = $this->usesSharedListFiltersPartial($content);
|
||||
$this->assertStringContainsString('initStandardListPage(', $content, $file);
|
||||
$this->assertStringContainsString("mode: 'drawer'", $content, $file);
|
||||
$this->assertStringNotContainsString('initListFilterExperience(', $content, $file);
|
||||
$this->assertStringContainsString('initStandardListPage(', $moduleContent, $file);
|
||||
$this->assertStringContainsString("mode: 'drawer'", $moduleContent, $file);
|
||||
$this->assertStringNotContainsString('initListFilterExperience(', $moduleContent, $file);
|
||||
if (!$usesPartial) {
|
||||
$this->assertStringContainsString('role="dialog"', $content, $file);
|
||||
$this->assertStringContainsString('aria-modal="true"', $content, $file);
|
||||
@@ -55,9 +65,10 @@ class FilterDrawerContractTest extends TestCase
|
||||
public function testAddressBookSaveFilterReadsAppliedGridState(): void
|
||||
{
|
||||
$content = $this->readProjectFile('pages/address-book/index(default).phtml');
|
||||
$moduleContent = $this->readProjectFile('web/js/pages/address-book-index.js');
|
||||
|
||||
$this->assertStringContainsString('new URL(gridConfig.baseUrl()).searchParams', $content);
|
||||
$this->assertStringNotContainsString('const state = collectFilterState();', $content);
|
||||
$this->assertStringContainsString('new URL(gridConfig.baseUrl()).searchParams', $moduleContent);
|
||||
$this->assertStringNotContainsString('const state = collectFilterState();', $moduleContent);
|
||||
$this->assertStringContainsString('data-filter-chips-clear-all-label', $content);
|
||||
$this->assertStringContainsString('data-filter-chips-remove-label', $content);
|
||||
$this->assertStringContainsString('data-filter-live-applied-message', $content);
|
||||
@@ -67,9 +78,8 @@ class FilterDrawerContractTest extends TestCase
|
||||
|
||||
public function testUsersResetKeepsTenantParam(): void
|
||||
{
|
||||
$content = $this->readProjectFile('pages/admin/users/index(default).phtml');
|
||||
|
||||
$this->assertStringContainsString("preserveFilterParams: ['tenant']", $content);
|
||||
$moduleContent = $this->readProjectFile('web/js/pages/admin-users-index.js');
|
||||
$this->assertStringContainsString("preserveFilterParams: ['tenant']", $moduleContent);
|
||||
}
|
||||
|
||||
public function testFilterDrawerAndExperienceImplementFocusTrapAndDirtyApplyUi(): void
|
||||
|
||||
Reference in New Issue
Block a user