© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
1 reply
ZedoX

Testing a Form Suffix Action

So i have a suffix action on a select
https://filamentphp.com/docs/3.x/forms/actions#adding-an-affix-action-to-a-field

Here is my current test:
livewire(ManageCardQRCodes::class)
  ->mountAction('export-qr-codes')
  ->fillForm([
      'batch_no' => $batchNo,
  ], 'mountedActionForm')
  ->callMountedAction()
  ->assertHasNoActionErrors()
  ->assertFileDownloaded("qr-codes-{$batchNo}.zip")
livewire(ManageCardQRCodes::class)
  ->mountAction('export-qr-codes')
  ->fillForm([
      'batch_no' => $batchNo,
  ], 'mountedActionForm')
  ->callMountedAction()
  ->assertHasNoActionErrors()
  ->assertFileDownloaded("qr-codes-{$batchNo}.zip")


And the action I'm testing
Actions\Action::make('export-qr-codes')
    ->form([
        Forms\Components\Select::make('batch_no')
            ->searchable()
            ->getSearchResultsUsing(function (string $search) {
                //REDACTED
            })
            ->suffixAction(
                //I want to call this action and assert batch_no has been set
                Forms\Components\Actions\Action::make('latest')
                    ->icon('heroicon-o-rectangle-stack')
                    ->action(function (Forms\Set $set) {
                        $latestBatchNo = //REDACTED

                        $set('batch_no', $latestBatchNo);
                    }),
            ),
    ])
Actions\Action::make('export-qr-codes')
    ->form([
        Forms\Components\Select::make('batch_no')
            ->searchable()
            ->getSearchResultsUsing(function (string $search) {
                //REDACTED
            })
            ->suffixAction(
                //I want to call this action and assert batch_no has been set
                Forms\Components\Actions\Action::make('latest')
                    ->icon('heroicon-o-rectangle-stack')
                    ->action(function (Forms\Set $set) {
                        $latestBatchNo = //REDACTED

                        $set('batch_no', $latestBatchNo);
                    }),
            ),
    ])
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Testing a form action.
FilamentFFilament / ❓┊help
2y ago
Refresh Form after suffix action
FilamentFFilament / ❓┊help
3y ago
Testing form actions
FilamentFFilament / ❓┊help
17mo ago
Suffix Action on table
FilamentFFilament / ❓┊help
3y ago