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
can you send the code you used with the fieldset? not sure i understand
I think he is saying Filters had a statePath on fieldsets basically so it's applied as a sub set
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]
i dont think thats the case unless you add a statepath to the fieldset
but i can verify this if you send the code
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
i really dont think thats the case, if you send code i can have a look.
theres no such thing as a nested filter, filters just have multiple form components
why is it dehydrated(false)
sorry for not removing that, that was from testing out my original issue. well what i thought it was
$livewire->tableFilters['housing_filter']['program_id']
can just be $state
or $get
testing should be ->filterTable('housing_filter', ['program_id' => 'xx', 'agency_id' => 'xx'])
etcget didnt work when they were set by query string. State make sense though
ok, great and thank!
query string shouldnt matter, $get will access the lw component exactly as you have