fix: ignore table sort while its column is toggled hidden
This commit is contained in:
1 parent
c4540cd302
commit
71ab17f6f2
3 files changed
+26
-2
No files matched your search
@@ -239,6 +239,27 @@ describe('rendering and sorting', function (): void {
|
||||
->sortTable('author.json.bar.baz', 'desc')
|
||||
->assertCanSeeTableRecords($sortedDesc, inOrder: true);
|
||||
});
|
||||
|
||||
it('ignores the sort of a `counts()` column while it is toggled hidden', function (): void {
|
||||
$users = collect([3, 1, 2])->map(
|
||||
fn (int $postsCount): User => User::factory()
|
||||
->has(Post::factory()->count($postsCount))
|
||||
->create(),
|
||||
);
|
||||
|
||||
$component = livewire(UsersTable::class)
|
||||
->sortTable('posts_count')
|
||||
->assertCanSeeTableRecords([$users[1], $users[2], $users[0]], inOrder: true)
|
||||
->toggleAllTableColumns(false);
|
||||
|
||||
expect($component->instance()->getFilteredSortedTableQuery()->toSql())
|
||||
->not->toContain('posts_count');
|
||||
|
||||
$component
|
||||
->assertCanSeeTableRecords($users, inOrder: true)
|
||||
->toggleAllTableColumns()
|
||||
->assertCanSeeTableRecords([$users[1], $users[2], $users[0]], inOrder: true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('searching', function (): void {
|
||||
|
||||
Reference in new issue
Block a user