You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[This issue is for discussion and to record information that may be useful to future maintainers.]
This PR adds a new helper bootstrap_form_with to support the Rails 5.1 form_with helper (Issue #326). Support for bootstrap_form_with was added by PR #369.
The code changes to the helpers to support bootstrap_form_with were not extensive, but testing was a challenge. form_with adds to the variety of expected outputs that tests have to handle. A couple of varieties of testing approaches were proposed in early versions of PR #369, and in #346, but all were deemed too complicated, or had too much duplication. In the end #369 includes a few tests to check specific form_with related functionality, but otherwise testing is left to form_for and form_tag.
If, as was announced originally, form_with will eventually replace form_for and form_tag, we'll have to update our tests. Originally, I thought it would be best to provide a complete suite of form_with tests now, while one has their head in the problem.
However, with Rails 5.2 on the horizon, I would propose that we do not increase test coverage for form_with until at least Rails 5.2, and then basically ignore testing of Rails 5.1 beyond what we currently have. This will eliminate one dimension of test variability. Also, my experience trying to use form_with in Rails 5.1 was sufficiently painful that I think we would be doing people a favour by encouraging them to switch to Rails 5.2 if they want to use form_with.
Eventually, we'll have to do all testing against form_with, but hopefully by then a number of the other variations in test will no longer be needed, because those versions are no longer supported. So testing should be easier at that time.
For the record, here are some examples of the differences in output that have accumulated over time (not just due to #369):
Prior to Rails 5, HTML tags were output in alphabetical order. After, they weren't
Rails 5.1. stopped generating default DOM ids in the form helpers, and stopped putting the new_... HTML class on forms. There may be other differences that I've forgotten already
Rails 5.2 returns to putting default DOM ids, but still doesn't put the HTML class on forms
form_with does submits via unobtrusive Javascript, so form tags are marked with data-remote="true".
[This issue is for discussion and to record information that may be useful to future maintainers.]
This PR adds a new helper bootstrap_form_with to support the Rails 5.1 form_with helper (Issue #326). Support for
bootstrap_form_withwas added by PR #369.The code changes to the helpers to support
bootstrap_form_withwere not extensive, but testing was a challenge.form_withadds to the variety of expected outputs that tests have to handle. A couple of varieties of testing approaches were proposed in early versions of PR #369, and in #346, but all were deemed too complicated, or had too much duplication. In the end #369 includes a few tests to check specificform_withrelated functionality, but otherwise testing is left toform_forandform_tag.If, as was announced originally,
form_withwill eventually replaceform_forandform_tag, we'll have to update our tests. Originally, I thought it would be best to provide a complete suite ofform_withtests now, while one has their head in the problem.However, with Rails 5.2 on the horizon, I would propose that we do not increase test coverage for
form_withuntil at least Rails 5.2, and then basically ignore testing of Rails 5.1 beyond what we currently have. This will eliminate one dimension of test variability. Also, my experience trying to useform_within Rails 5.1 was sufficiently painful that I think we would be doing people a favour by encouraging them to switch to Rails 5.2 if they want to useform_with.Eventually, we'll have to do all testing against
form_with, but hopefully by then a number of the other variations in test will no longer be needed, because those versions are no longer supported. So testing should be easier at that time.For the record, here are some examples of the differences in output that have accumulated over time (not just due to #369):
assert_equivalent_xmlis found in Rewrite tests to work on Rails 4.0, 4.1, 4.2, and 5.0 #273 and Testing multiple versions of Rails #278, which specifically addressed these first two issues.)form_withdoes submits via unobtrusive Javascript, soformtags are marked withdata-remote="true".(https://m.patrikonrails.com/rails-5-1s-form-with-vs-old-form-helpers-3a5f72a8c78a is an easy-to-read summary of differences between
form_forandform_with.)