mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
updated docs
This commit is contained in:
@@ -489,6 +489,28 @@ it('can load existing post data for editing', function () {
|
||||
});
|
||||
```
|
||||
|
||||
You may also find it useful to pass a function to the `assertTableActionDataSet()` and `assertTableBulkActionDataSet()` method, which allows you to access the form `$state` and perform additional assertions:
|
||||
|
||||
```php
|
||||
use Illuminate\Support\Str;
|
||||
use function Pest\Livewire\livewire;
|
||||
|
||||
it('can automatically generate a slug from the title without any spaces', function () {
|
||||
$post = Post::factory()->create();
|
||||
|
||||
livewire(PostResource\Pages\ListPosts::class)
|
||||
->mountTableAction(EditAction::class, $post)
|
||||
->assertTableActionDataSet(function (array $state) use($post): array {
|
||||
expect($state['slug'])
|
||||
->not->toContain(' ');
|
||||
|
||||
return [
|
||||
'slug' => Str::slug($post->title),
|
||||
];
|
||||
});
|
||||
});
|
||||
```
|
||||
|
||||
### Action state
|
||||
|
||||
To ensure that an action or bulk action exists or doesn't in a table, you can use the `assertTableActionExists()` / `assertTableActionDoesNotExist()` or `assertTableBulkActionExists()` / `assertTableBulkActionDoesNotExist()` method:
|
||||
|
||||
Reference in New Issue
Block a user