Skip to content

Commit

Permalink
Adds the page name to pagination links in the tailwind template (#1616)
Browse files Browse the repository at this point in the history
* Adding page names to the links for the next and previous page

* Fix pagination tests

* Fix pagination tests
  • Loading branch information
lsmedia authored Jul 19, 2024
1 parent d9ff65d commit 9477741
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class="w-5 h-5"

<a
class="cursor-pointer relative inline-flex items-center px-2 py-2 text-sm font-medium text-pg-primary-500 dark:text-pg-primary-300 bg-white dark:bg-pg-primary-600 border border-pg-primary-300 dark:border-transparent leading-5 hover:text-pg-primary-400 focus:z-10 focus:outline-none focus:shadow-outline-blue active:bg-pg-primary-100 active:text-pg-primary-500 transition ease-in-out duration-150"
wire:click="previousPage"
wire:click="previousPage('{{ $paginator->getPageName() }}')"
rel="next"
>
<svg
Expand Down Expand Up @@ -120,7 +120,7 @@ class="select-none cursor-pointer relative inline-flex items-center px-3 py-2 -m
@if ($paginator->lastPage() - $paginator->currentPage() >= 2)
<a
class="select-none cursor-pointer relative inline-flex items-center px-2 py-2 text-sm font-medium text-pg-primary-500 dark:text-pg-primary-300 bg-white dark:bg-pg-primary-600 border border-pg-primary-300 dark:border-transparent leading-5 hover:text-pg-primary-400 focus:z-10 focus:outline-none focus:shadow-outline-blue active:bg-pg-primary-100 active:text-pg-primary-500 transition ease-in-out duration-150"
wire:click="nextPage"
wire:click="nextPage('{{ $paginator->getPageName() }}')"
rel="next"
>
<svg
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@
->livewire(DishesTable::class)
->set('setUp.footer.perPage', '4')

->assertSeeHtml('wire:click="nextPage"')
->assertSeeHtml('wire:click="nextPage(\'page\')"')
//page #2
->call('gotoPage', '2')
->assertSeeHtml('wire:click="nextPage"');
->assertSeeHtml('wire:click="nextPage(\'page\')"');

it('displays previous links "<" and "<<"')
->livewire(DishesTable::class)
->assertDontSeeHtml('wire:click="previousPage"')
->assertDontSeeHtml('wire:click="previousPage(\'page\')"')
//page #2
->call('gotoPage', '2')
->assertSeeHtml('wire:click="previousPage"');
->assertSeeHtml('wire:click="previousPage(\'page\')"');

it('searches for something that is not on the current page')
->livewire(DishesTable::class)
Expand Down

0 comments on commit 9477741

Please sign in to comment.