BLADE);
expect($html)
->toContain('table-toolbar')
->toContain('table-search')
->toContain('wire:model.live="search"')
->not->toContain('x-teleport="body"')
->toContain('floatingDropdown(')
->toContain('position: fixed')
->toContain('floating-dropdown-panel')
->toContain('x-show="open"')
->toContain('schedulePosition($el)')
->toContain("visibility: positioned ? 'visible' : 'hidden'")
->not->toContain('positionPanel() {')
->not->toContain('x-show="open && positioned"')
->toContain('aria-multiselectable="true"')
->toContain('Reset filters')
->toContain('wire:click="clearFilters"')
->toContain('Sort');
});
it('centralizes floating dropdown positioning in an Alpine data provider', function () {
$layout = file_get_contents(resource_path('views/layouts/base.blade.php'));
$provider = file_get_contents(resource_path('views/components/floating-dropdown-script.blade.php'));
expect($layout)->toContain("@include('components.floating-dropdown-script')")
->and($provider)
->toContain('window.floatingDropdown = function floatingDropdown')
->toContain('window.requestAnimationFrame')
->toContain('positionPanel(panel = null)')
->toContain('const desiredWidth = config.matchTriggerWidth')
->toContain('? triggerRect.width')
->not->toContain('? Math.max(triggerRect.width, panel.offsetWidth)')
->toContain('window.innerWidth < 768');
});
it('renders the standard table loading overlay', function () {
$html = Blade::render('
');
expect($html)
->toContain('table-loading-overlay')
->toContain('wire:loading.flex')
->toContain('wire:target="applyFilters"')
->toContain('[&_.loading-indicator]:size-5')
->toContain('aria-label="Loading records..."')
->not->toContain('Loading records...');
});
it('uses shared table controls on backend filtered tables', function () {
$deployments = file_get_contents(resource_path('views/livewire/project/application/deployment/index.blade.php'));
$environmentVariables = file_get_contents(resource_path('views/livewire/project/shared/environment-variable/all.blade.php'));
foreach ([$deployments, $environmentVariables] as $view) {
expect($view)
->toContain('toContain('toContain('toContain('toContain('toContain('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('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, '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)"/');
});