mirror of
https://github.com/filamentphp/filament.git
synced 2026-09-24 15:42:09 +08:00
Add failing test for action with arguments
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\Testing\TestAction;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tests\Actions\TestCase;
|
||||
use Filament\Tests\Fixtures\Pages\Actions;
|
||||
@@ -132,6 +133,18 @@ it('can mount an action with arguments', function (): void {
|
||||
]);
|
||||
});
|
||||
|
||||
it('can mount an action record with arguments', function (): void {
|
||||
livewire(Actions::class)
|
||||
->mountAction([
|
||||
TestAction::make('record-arguments')->arguments(['key' => 123]),
|
||||
'record-arguments',
|
||||
])
|
||||
->callMountedAction()
|
||||
->assertDispatched('record-arguments-called', arguments: [
|
||||
'key' => 123,
|
||||
]);
|
||||
});
|
||||
|
||||
it('can mount a nested action with parent arguments', function (): void {
|
||||
livewire(Actions::class)
|
||||
->mountAction([
|
||||
|
||||
@@ -47,6 +47,8 @@ class Actions extends Page
|
||||
$this->dispatch('nested-called', arguments: $arguments);
|
||||
}),
|
||||
]),
|
||||
Action::make('record-arguments')
|
||||
->record(fn (array $arguments) => $arguments['key']),
|
||||
Action::make('parent')
|
||||
->schema([
|
||||
TextInput::make('foo')
|
||||
|
||||
Reference in New Issue
Block a user