Closed bencallaway closed 2 years ago
@bencallaway are you able to give me a worked example so I can see the usecase?
I'm not sure if this needs to be a new feature to pollute the already complex api as there is a known bug on multi collection checkboxes here - https://github.com/trailblazer/formular/issues/57
This technically works, but tests have not yet been updated to reflect the effective order of html attributes. I wanted to run the intent of this PR by you guys before fixing those, and refactoring this changeset to be a little easier on the eyes.
When dealing with checkbox collections one should be able to designate what value(s) should be matched and therefore rendered as
checked="checked"
. This is especially useful when called as a method on a builder. Following the lead ofFormular::Element::Select
I'm using the:value
option for this purpose, but admittedly it does get a little confusing with both:default
and:with_collection
contexts, and with other options like:checked_value
.Regardless, if the direction posited in
elements_test.rb
looks right, then I can clean up & clarify my changes inFormular::Element::Checkable
and add comparable test coverage for radio type inputs.