ZedoX
ZedoX
FFilament
Created by ZedoX on 10/21/2023 in #❓┊help
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);
}),
),
])
2 replies
FFilament
Created by ZedoX on 3/13/2023 in #❓┊help
TagsInput Validation
How can i apply a validation rule to individual tags, of a TagsInput.
Forms\Components\TagsInput::make('tags')
->alphaDash(), //This always fail
Forms\Components\TagsInput::make('tags')
->alphaDash(), //This always fail
16 replies