aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/test/template/form_helper_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Turn on performance based copsDillon Welch2018-07-231-1/+2
| | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* Don't enforce UTF-8 by defaultAndrew White2018-02-271-0/+37
| | | | | | With the disabling of TLS 1.0 by most major websites, continuing to run IE8 or lower becomes increasingly difficult so default to not enforcing UTF-8 encoding as it's not relevant to other browsers.
* Change translation key of submit_tag from module_name_class_name to ↵Rui Onodera2018-02-271-1/+19
| | | | | | | | | | module_name/class_name Currently submit_tag value translation does not support i18n key style locale key. It confuses me a bit because many other components support i18n key style locale key. I added i18n key style locale key support to submit tag.
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-2/+2
|
* Suppress `warning: BigDecimal.new is deprecated`Yasuo Honda2017-12-151-3/+3
| | | | | | | | | | | | | | | | | | | | `BigDecimal.new` has been deprecated in BigDecimal 1.3.3 which will be a default for Ruby 2.5. Refer https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503 * This commit has been made as follows: ``` cd rails git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g" ``` - `activesupport/test/xml_mini_test.rb` Editmanually to remove `.new` and `::` - guides/source/5_0_release_notes.md This is a Rails 5.0 release notes.
* Enable `Style/DefWithParentheses` rubocop ruleRyuta Kamizono2017-11-271-1/+1
| | | | | | | The def with blank `()` was newly added in #31176, but we have not used the blank `()` style in most part of our code base. So I've enabled `Style/DefWithParentheses` to prevent to newly added the code.
* Add test to make sure form_for is not affected byRafael Mendonça França2017-11-251-0/+32
| | | | form_with_generates_ids
* Fix RuboCop offensesKoichi ITO2017-08-161-1/+1
| | | | And enable `context_dependent` of Style/BracesAroundHashParameters cop.
* Refactor convert_direct_upload_option_to_urlRafael Mendonça França2017-08-031-0/+31
| | | | Also make sure file_field doesn't mutate the original options passed in.
* Use frozen string literal in actionview/Kir Shatrov2017-07-241-0/+2
|
* Enable `Layout/FirstParameterIndentation` copRyuta Kamizono2017-07-171-2/+2
| | | | | | | We have some indentation cops. But now there is a little inconsistent params indentations. Enable `Layout/FirstParameterIndentation` cop to prevent newly inconsistent indentation added and auto-correct to existing violations.
* Expectation firstAkira Matsuda2017-07-021-4/+4
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Merge pull request #29540 from kirs/rubocop-frozen-stringMatthew Draper2017-07-021-0/+1
|\ | | | | | | Enforce frozen string in Rubocop
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
* | Make ActionView frozen string literal friendly.Pat Allan2017-06-201-3/+3
|/ | | | Plus a couple of related ActionPack patches.
* Set correct "routes" in tests casesbogdanvlviv2017-02-201-2/+2
|
* Add `Style/EmptyLinesAroundMethodBody` in `.rubocop.yml` and remove extra ↵Ryuta Kamizono2017-02-121-1/+0
| | | | empty lines
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-207/+207
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* Merge pull request #27463 from y-yagi/fix_26931Rafael França2016-12-281-1/+3
|\ | | | | do not mutate `object_name` of class in `fields_for`
| * do not mutate `object_name` of class in `fields_for`yuuji.yaginuma2016-12-271-1/+3
| | | | | | | | | | | | Since it affects the entire form, should not mutate `object_name` of class. Fixes #26931
* | Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-281-3/+3
|/ | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* Privatize unneededly protected methods in Action View testsAkira Matsuda2016-12-231-1/+1
|
* Unneeded attr_accessor with side effectsAkira Matsuda2016-12-231-4/+0
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-21/+21
|
* Merge pull request #26516 from grosser/grosser/assertRafael França2016-09-161-1/+1
|\ | | | | improve error message when include assertions fail
| * improve error message when include assertions failMichael Grosser2016-09-161-1/+1
| | | | | | | | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* | Rename test to match what it doesclaudiob2016-09-151-1/+1
|/ | | | | | | | | | | Commit d270da569 changed the `form_for` API from `:object_name` to `:as`. It also change the related test body, but not its title, which is changed here. See https://github.com/rails/rails/commit/d270da569efeabd7cd563028816452236713aa9f#diff-52455f1e82acf12551bc5e7e26b82008 I realize this is a small commit but I was having trouble understanding what the test was about since there is no "object_name" in the code. I imagine the same may happen to other developers, therefore this commit.
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Fix broken alignments caused by auto-correct commit 411ccbdRyuta Kamizono2016-08-101-3/+6
| | | | Hash syntax auto-correcting breaks alignments. 411ccbdab2608c62aabdb320d52cb02d446bb39c
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* normalizes indentation and whitespace across the projectXavier Noria2016-08-061-54/+54
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-10/+4
|
* modernizes hash syntax in actionviewXavier Noria2016-08-061-4/+4
|
* applies new string literal convention in actionview/testXavier Noria2016-08-061-162/+162
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Change datetime to datetime-local helper tagHerminio Torres2016-06-211-80/+18
| | | | | | | | | | | A change was made in the helper that renders the `datetime`, being now by default `datetime-local` and creating an alias of `datetime-local` for `datetime`, `datetime` tag and it passes to be an abstract class for all other tags that inherit from him. As a new specification of the HTML 5 the text field type `datetime` will no longer exist and will pass a `datetime-local`. Ref: https://html.spec.whatwg.org/multipage/forms.html#local-date-and-time-state-(type=datetime-local)
* Revert "Merge pull request #17973 from maurogeorge/file_field_hidden_field"eileencodes2016-06-211-20/+5
| | | | | | | | | | | | | The reason we are reverting this commit is because it created breaking changes for file upload gems. For more information see discussion here: https://github.com/rails/rails/issues/17947#issuecomment-225154294 This reverts commit c455817804e4df64c46c17a0cdec0e5a1ca5ba2e, reversing changes made to 8b3cd74b8a09ef85a43d7631bb062a9ec7f57227. Conflicts: actionview/CHANGELOG.md actionview/lib/action_view/helpers/form_helper.rb
* Deprecate `datetime_field` and `datetime_field_tag` helpers.Wojciech Wnętrzak2016-03-311-8/+24
| | | | | Datetime input type was removed from HTML specification. One can use `datetime_local_field` and `datetime_local_field_tag` instead.
* Revert "Merge pull request #22764 from ↵Rafael Mendonça França2016-03-051-21/+3
| | | | | | | | | | stevenspiel/titleize_model_name_for_default_submit_button_value" This reverts commit 4158974c60d817c9bc1e2aecb342161295f2ac0d, reversing changes made to 3d590add45b7ff1de972d99b076cb504d5208935. Reason: This break i18n in some languages. See https://github.com/rails/rails/issues/791#issuecomment-192724640
* html_safe is not supposed to be public API for AV. This change removes usage ↵Vipul A M2016-01-201-2/+2
| | | | | | of html_safe in favour of raw() in AV helpers. Also changed usage of html_safe to make use of raw() instead so that the intended behaviour is verified with raw()
* Merge pull request #22764 from ↵Rafael França2016-01-041-3/+21
|\ | | | | | | | | stevenspiel/titleize_model_name_for_default_submit_button_value titleize the model name on default submit buttons
| * downcase default submit button value's model nameSteven Spiel2016-01-011-3/+21
| |
* | Fix collection_radio_buttons' hidden_field name and make it appear before ↵Santiago Pastorino2015-12-311-18/+18
|/ | | | | | the radios Fixes #22773
* Fix week_field returning invalid valueChristoph2015-11-101-4/+10
| | | | | | | According to the W3 spec[1] the value should use a 1-based index and not a 0-based index for the week number. [1]: http://www.w3.org/TR/html-markup/datatypes.html#form.data.week
* Merge pull request #22116 from gsamokovarov/fix-form-for-block-testYves Senn2015-10-291-2/+3
|\ | | | | Fix a faulty form_for test
| * Fix a faulty form_for testGenadi Samokovarov2015-10-291-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Stumbled upon this one while trying to deprecate the String/Symbol passing to `form_for`. This test passed on an accident, because the signature of `form_for` currently accepts 2 positional arguments and a block. Calling it with the wrong number of arguments caused: ```ruby (byebug) form_for(:post, @post, html: { id: 'create-post' }) *** ArgumentError Exception: wrong number of arguments (3 for 1..2) ``` This made the test pass, because it was still an `ArgumentError`. :-)
* | Merge pull request #21431 from ojab/masterRafael Mendonça França2015-09-261-0/+21
|\ \ | | | | | | Handle nested fields_for by adding indexes to record_name
| * | Handle nested fields_for by adding indexes to record_nameojab2015-08-301-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In case of the form with nested fields_for, i. e. <%= form_for :foos, url: root_path do |f| %> <% @foos.each do |foo| %> <%= f.fields_for 'foo[]', foo do |f2| %> <%= f2.text_field :id %> <% foo.bars.each do |bar| %> <%= f2.fields_for 'bar[]', bar do |b| %> <%= b.text_field :id %> <% end %> <% end %> <% end %> <% end %> <%= f.submit %> <% end %> rails doesn't add index for 'foo' in the inner fields_for block, so field names in the outer fields_for looks like "foos[foo][#{foo_index}][id]" and in the inner "foos[foo[]][bar][#{bar_index}][id]". Submitting of such form leads to an error like: >ActionController::BadRequest (Invalid request parameters: expected Array >(got Rack::QueryParser::Params) for param `foo'): This commit adds indexes for the foos in the inner blocks, so field names become "foos[foo][#{foo_index}][bar][#{bar_index}][id]" and submitting of such form works fine as expected. Fixes #15332
* | | Add a hidden field on the collection_radio_buttonsMauro George2015-09-241-4/+9
| |/ |/| | | | | | | This will avoid a error be raised when the only input on the form is the `collection_radio_buttons`.
* | :hocho: TyposAkira Matsuda2015-09-211-1/+1
|/