F
Filament2mo ago
shabxs

Testing Infolists headerAction

How do we test infolist headerAction which is on an ViewPage with infolist
Solution:
define a key in the section, ->key('sectionStatus') Then, you can use ```php ->assertInfolistActionExists('sectionStatus','updateStatus')...
Jump to solution
4 Replies
LeandroFerreira
LeandroFerreira2mo ago
what code are you using?
shabxs
shabxs2mo ago
return $infolist ->schema([ Section::make('DETAILS AND STATUS') ->headerActions( [ Action::make('updateStatus') ->fillForm(fn (Program $record): array => [ 'ProgramStatus' => $record->status, ]) ->form([ Select::make('ProgramStats') ->label('Program Status') ->options(fn() => ProgramStatus::class) ->required(), ]) ->action(function (array $data, Program $record): void { $record->status = $data['ProgramStatus'] ; $record->save(); }), I wanted to test this updateStatus action on a section header of infolist.
Solution
LeandroFerreira
LeandroFerreira2mo ago
define a key in the section, ->key('sectionStatus') Then, you can use
->assertInfolistActionExists('sectionStatus','updateStatus')
->mountInfolistAction('sectionStatus','updateStatus')
->assertInfolistActionExists('sectionStatus','updateStatus')
->mountInfolistAction('sectionStatus','updateStatus')
shabxs
shabxs2mo ago
Thanks for that quick reply... testing worked.. Also it seems that instead of 'key' we can also use 'id'. I believe both serve the same purpose
Want results from more Discord servers?
Add your server
More Posts
getUrl() Method not working on ModelGood morning. Hoping someone might have some insight, I can't find a clear answer with search. I'mhow to create two filament resource that corresponds to one model?I have this table named taxonomies with following fields. ``` $table->id(); $table->string('name');Conditional validation on field in a repeaterHi all, I have some difficulties to run validation on fields in repeater fields... So, let me explaiTarget class [filament] does not exist. ?Why am I getting this error when I try to send a get request from PostMan? Everything is installed pHow to Access image in filament if I want to modify that .How to Access image in filament if I want to modify that like I am trying to upload image on BunnyCDCalling $wire.$id inside custom form element returns the whole form ID and not only the element.I am trying to use `$wire.$call('myFunction')` from inside a custom form component, but I get `UnablResource vs Page for Stock Management & Reporting?Hi there, I am quite new to Filament and now have to build a Stock Management & Reporting view for mIs there anyway to reload RelationManager Owner page with Spa mode?In my CreateAction of the RelationManager, I have update some ower model data, I then want it to refIssues with scrolling relationship manager modal on IOS DevicesHi everyone, Hoping someone has had this issue as well 🙂 I've followed the pre-issue report guidemultiple() select not work with afterStateUpdatedgenerate attribute values based on the selected attributes and add them into the repeater