F
Filament14mo ago
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);
}),
),
])
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server