Update layout: inline at field level for Bootstrap 4.#433
Update layout: inline at field level for Bootstrap 4.#433mattbrictson merged 13 commits intobootstrap-ruby:masterfrom
layout: inline at field level for Bootstrap 4.#433Conversation
Here's an example of a CHANGELOG.md entry (place it immediately under the * [#433](https://github.com/bootstrap-ruby/bootstrap_form/pull/433): Update `layout: inline` at field level for Bootstrap 4. - [@lcreid](https://github.com/lcreid).Generated by 🚫 Danger |
mattbrictson
left a comment
There was a problem hiding this comment.
Thanks for putting this PR together.
These changes seem OK to me, but I don't really understand many of the tests. Do the tests represent real-world scenarios? When I copy the expected HTML in to bootply.com to preview, the rendered forms in many cases look undesirable.
I guess my question is: just because we can test every combination of options, should we?
|
The tests aren't "real-world" in that the form layout is declared one way, and then all the fields inside are declared with another layout. However, our documentation says you can override the form level layout with field level layout, so I think it should be tested. The test output that should look ugly in Bootply are where the form is Thanks for the the merges today, @mattbrictson ! I think we're getting close to alpha. |
|
Doh! It took a while but I think I realized what you were getting at, @mattbrictson . I removed the tests that were testing the overrides of in-line output, so that in the future no one will think that, because it's in a test case, it's the correct output. Since the links may not be anywhere else, here's what trying to override in-line layouts looks like at the time of writing: https://www.bootply.com/1hMYpBHds5 and: https://www.bootply.com/JqdpfgA36j. Hopefully this can be approved now. :-) |
mattbrictson
left a comment
There was a problem hiding this comment.
Looks good; thanks for the follow up. I am seeing some odd things in the diff, like a repetition of the changes that were already in #438. I'll rebase to hopefully clear that up and then merge.
Need to check/update all the Bootply rendered versions.
Need to check/update all the Bootply rendered versions.
966cb1f to
0507950
Compare
|
Rebased |
…by#433) * Test the combinations of layout at form and control level. * Strip layout from options for check boxes and radios. * Improve the tests. * Update tests to new markup. * All but custom. Need to check/update all the Bootply rendered versions. * Tweak label classes for visual rendering. * Test the combinations of layout at form and control level. * Strip layout from options for check boxes and radios. * Improve the tests. * All but custom. Need to check/update all the Bootply rendered versions. * Tweak label classes for visual rendering. * Remove incorrect tests. * Check rendering and add links to Bootply.
For
layout: :inlineelements to look right, Bootstrap 4 requires some markup at a "lower level" of the HTML than Bootstrap 3 did. This PR ensures that the elements correctly calculate whether the developer has requested in-line layout, and applies the appropriate classes.In some cases, classes for in-line layout are applied regardless of whether the layout was specified at the form level or the field level. In other cases, the markup is only needed and applied if the in-line layout was only specified at the field level.
This PR adds a number of test cases for the six variations of form-level and field-level layout being different. The test cases test a few different types of fields:
I think it's important to have this level of test coverage, even if it could be argued that some of this might be tested elsewhere. (I thought that the date/time selects were similar enough to the others to forgo a test.)
There will be two outstanding issues after this PR is merged:
If you have an in-line
form-groupwith one or more radio buttons or check boxes inside it, the baseline of theform-group's label won't be exactly the same as the baseline of the radio button or check box labels. (See https://www.bootply.com/fH5sF4fcju.)Overriding form-level
layout: :inlineat the field level does not work. See Overridinglayout: :inlineat field level. #432.Fixes #426.
Fixes #416.