Nested filters and filterTable() testing

All i wanted was to create some layout changes in my filters by using a fieldset. Unfortunately that results in my filters becoming nested, which means their query strings are different, nested filters dont appear to be supported by filterTable() for pest testing, and checking active filters is different too. If I am forced to have it nested (unfortunately ->dehydrated(false) doesnt seem to help on the fieldset), how can I test my filters and/or should filterTable() be expanded to support nested ones?
12 Replies
Dan Harrin
Dan Harrin15mo ago
can you send the code you used with the fieldset? not sure i understand
toeknee
toeknee15mo ago
I think he is saying Filters had a statePath on fieldsets basically so it's applied as a sub set
Mark Chaney
Mark Chaney15mo ago
I have a Filter::make() with ->form() set and that form schema is a Fieldset::make(‘Foo’) and then within it a few Selects. That makes the selects within it fall under foo, so ends up being [foo][project_id] instead of just [project_id]
Dan Harrin
Dan Harrin15mo ago
i dont think thats the case unless you add a statepath to the fieldset but i can verify this if you send the code
Mark Chaney
Mark Chaney15mo ago
well it was 4am, the nested part is because of the Filter::make('foo'), which does require a name and holds the form() and selects within it. So i guess my issue is simply the test not being able to handle nested filters and since a nested one is really a custom one, i guess i need to figure out my own testing method
Dan Harrin
Dan Harrin15mo ago
i really dont think thats the case, if you send code i can have a look.
Dan Harrin
Dan Harrin15mo ago
theres no such thing as a nested filter, filters just have multiple form components why is it dehydrated(false)
Mark Chaney
Mark Chaney15mo ago
sorry for not removing that, that was from testing out my original issue. well what i thought it was
Dan Harrin
Dan Harrin15mo ago
$livewire->tableFilters['housing_filter']['program_id'] can just be $state or $get testing should be ->filterTable('housing_filter', ['program_id' => 'xx', 'agency_id' => 'xx']) etc
Mark Chaney
Mark Chaney15mo ago
get didnt work when they were set by query string. State make sense though ok, great and thank!
Dan Harrin
Dan Harrin15mo ago
query string shouldnt matter, $get will access the lw component exactly as you have
Want results from more Discord servers?
Add your server
More Posts