Add failing test for action with arguments

This commit is contained in:
Ben
2025-08-13 21:39:34 +01:00
parent f006836224
commit 85aff62fe1
2 changed files with 15 additions and 0 deletions
+13
View File
@@ -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([
+2
View File
@@ -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')