diff --git a/docs/10-testing/03-testing-tables.md b/docs/10-testing/03-testing-tables.md index c58b90203f..49bc431a38 100644 --- a/docs/10-testing/03-testing-tables.md +++ b/docs/10-testing/03-testing-tables.md @@ -115,16 +115,23 @@ Once the table is sorted, you can ensure that the table records are rendered in use function Pest\Livewire\livewire; it('can sort posts by title', function () { - $posts = Post::factory()->count(10)->create(); + Post::factory()->count(10)->create(); + + $sortedPostsAsc = Post::query()->orderBy('title')->get(); + $sortedPostsDesc = Post::query()->orderBy('title', 'desc')->get(); livewire(PostResource\Pages\ListPosts::class) ->sortTable('title') - ->assertCanSeeTableRecords($posts->sortBy('title'), inOrder: true) + ->assertCanSeeTableRecords($sortedPostsAsc, inOrder: true) ->sortTable('title', 'desc') - ->assertCanSeeTableRecords($posts->sortByDesc('title'), inOrder: true); + ->assertCanSeeTableRecords($sortedPostsDesc, inOrder: true); }); ``` + + ### Testing the state of a column To assert that a certain column has a state or does not have a state for a record you can use `assertTableColumnStateSet()` and `assertTableColumnStateNotSet()`: