From 21695474e46fbd01bfef11dd2f92ef9433116823 Mon Sep 17 00:00:00 2001 From: chester Date: Fri, 10 Jan 2025 08:35:02 +0800 Subject: [PATCH] added to the docs --- packages/tables/docs/12-testing.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/tables/docs/12-testing.md b/packages/tables/docs/12-testing.md index 21fea2122d..a32dc0c885 100644 --- a/packages/tables/docs/12-testing.md +++ b/packages/tables/docs/12-testing.md @@ -349,6 +349,20 @@ it('can remove all table filters', function () { }); ``` +### Authorization + +To ensure that a particular user cannot see a filter, you can use the `assertTableFilterVisible()` and `assertTableFilterHidden()` methods: + +```php +use function Pest\Livewire\livewire; + +it('shows the correct filters', function () { + livewire(PostResource\Pages\ListPosts::class) + ->assertTableFilterVisible('created_at') + ->assertTableFilterHidden('author'); +}); +``` + ## Actions ### Calling actions