Closed dsamburskyi closed 2 years ago
Hello, and thank you for your suggestion. I'm sorry to keep you waiting so long, but in case you are still curious about this, I wanted to take the time to answer.
When I first created this assertion, I had some components that had completely empty field sets; no fields, no field elements - just a title, some actions and filters. I don't work on that application anymore, and I'm not even sure why I insisted that the field list be just an empty array, I just remember that's why I wrote this assertion.
At this point, I don't know whether most developers would prefer that this method assert that the field list is empty, or that it just contains no Fields. However, I would be open to considering a PR if it could address both scenarios.
Closing due to inactivity
We're using Devpartners\AuditableLog panel, which contains ResourceToolElements (extending Laravel\Nova\Fields\FieldElement). It's returned in
$resource->component->fields()
and thus being counted in assertHasNoFields()but findField() function returns only fields extending Laravel\Nova\Fields\Field. So there's a disconnect between these two assertions. On one hand the 'field' is counted, but on the other hand it's not findable.
I may try to come up with a PR for this, but not sure what expected behavior is supposed to be, include Elements too or make assertHasNoFields() filter out non-Fields.