mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-23 16:23:53 +00:00
feat(ui): standardize paginated tables and responsive dropdowns
Add reusable pagination and page-size controls, improve mobile dropdown positioning, and migrate paginated views to consistent table components.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
it('renders the standard table toolbar controls', function () {
|
||||
$html = Blade::render(<<<'BLADE'
|
||||
@@ -21,6 +22,16 @@ it('renders the standard table toolbar controls', function () {
|
||||
->toContain('table-toolbar')
|
||||
->toContain('table-search')
|
||||
->toContain('wire:model.live="search"')
|
||||
->toContain('x-teleport="body"')
|
||||
->toContain('positionPanel')
|
||||
->toContain('position: fixed')
|
||||
->toContain('floating-dropdown-panel')
|
||||
->toContain('window.innerWidth < 768')
|
||||
->toContain('(window.innerWidth - panelWidth) / 2')
|
||||
->toContain('panel.style.width = `${panelWidth}px`')
|
||||
->toContain('panel.style.maxWidth = `${window.innerWidth - (edge * 2)}px`')
|
||||
->toContain('x-show="open"')
|
||||
->not->toContain('x-show="open && positioned"')
|
||||
->toContain('aria-multiselectable="true"')
|
||||
->toContain('Reset filters')
|
||||
->toContain('wire:click="clearFilters"')
|
||||
@@ -61,3 +72,30 @@ it('uses the standard search control for frontend filtered infrastructure tables
|
||||
->toContain('clear-when="search"')
|
||||
->toContain("clear-action=\"search = ''\"");
|
||||
});
|
||||
|
||||
it('uses the collision aware dropdown on the projects page', function () {
|
||||
$projects = file_get_contents(resource_path('views/livewire/project/index.blade.php'));
|
||||
|
||||
expect($projects)
|
||||
->toContain('<x-table.dropdown')
|
||||
->not->toContain('x-show="sortOpen"');
|
||||
});
|
||||
|
||||
it('uses collision aware filter and sort dropdowns on the resources page', function () {
|
||||
$resources = file_get_contents(resource_path('views/livewire/project/resource/index.blade.php'));
|
||||
|
||||
expect(substr_count($resources, '<x-table.dropdown'))->toBeGreaterThanOrEqual(2)
|
||||
->and($resources)
|
||||
->not->toContain('x-show="filterOpen"')
|
||||
->not->toContain('x-show="sortOpen"');
|
||||
});
|
||||
|
||||
it('does not use legacy floating sort or filter panels', function () {
|
||||
$views = collect(File::allFiles(resource_path('views')))
|
||||
->filter(fn (SplFileInfo $file): bool => $file->getExtension() === 'php')
|
||||
->map(fn (SplFileInfo $file): string => $file->getContents())
|
||||
->implode("\n");
|
||||
|
||||
expect($views)
|
||||
->not->toMatch('/x-show="(?:sortOpen|filterOpen|filtersOpen)"/');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user