false); $html = Blade::render(<<<'BLADE' BLADE); expect($html)->toMatch('/]*aria-label="Items per page"[^>]*\sdisabled(?:[=\s>])/') ->toMatch('/]*aria-label="Custom items per page"[^>]*\sdisabled(?:[=\s>])/'); }); it('renders loading indicators for livewire page navigation', function () { $html = Blade::render( '' ); expect($html) ->toContain('1–10') ->toContain('13') ->toContain('wire:target="goToPage,previousPage,nextPage"') ->toContain('wire:loading') ->toContain('wire:loading.attr="disabled"') ->toContain('wire:loading.inline-flex') ->toContain('animate-spin') ->toContain('Loading page…') ->toContain('wire:click="previousPage"') ->toContain('wire:click="nextPage"') ->toContain('aria-label="Next page"') ->not->toContain('aria-label="First page"') ->not->toContain('aria-label="Last page"'); // A single spinner appears next to the range while Livewire loads the next page. expect(substr_count($html, 'animate-spin'))->toBe(1) ->and(substr_count($html, 'Loading page…'))->toBe(1); }); it('omits livewire loading markup when no wire target is provided', function () { $html = Blade::render( '' ); expect($html) ->toContain('1–5') ->not->toContain('wire:loading') ->not->toContain('wire:target') ->not->toContain('Loading page…'); }); it('keeps the footer on one page while a larger page size is selected', function (int $total, bool $hidden) { $html = Blade::render( ' ', ['total' => $total] ); expect((bool) preg_match('/]*\shidden[\s>]/', $html))->toBe($hidden); })->with([ 'more rows than the smallest page size' => [15, false], 'all rows fit in the smallest page size' => [10, true], ]); it('hides the footer on one page when there is no page size control', function () { $html = Blade::render(''); expect($html)->toMatch('/]*\shidden[\s>]/'); });