diff options
author | Joost Baaij <joost@spacebabies.nl> | 2014-04-14 00:38:46 +0200 |
---|---|---|
committer | Joost Baaij <joost@spacebabies.nl> | 2014-04-14 19:45:12 +0200 |
commit | 89ff1f82f01bd70e12ec1b45049be30ac262df30 (patch) | |
tree | 3008e03d3170c996e0524cc72188141aafd92d79 /actionview/test/activerecord | |
parent | 4baa866e35a2c08aa236ac83c061e3343e951a49 (diff) | |
download | rails-89ff1f82f01bd70e12ec1b45049be30ac262df30.tar.gz rails-89ff1f82f01bd70e12ec1b45049be30ac262df30.tar.bz2 rails-89ff1f82f01bd70e12ec1b45049be30ac262df30.zip |
Remove wrapping div with inline styles for hidden form fields.
We are dropping HTML 4.01 and XHTML strict compliance since input
tags directly inside a form are valid HTML5, and the absense of
inline styles help in validating for Content Security Policy.
Diffstat (limited to 'actionview/test/activerecord')
-rw-r--r-- | actionview/test/activerecord/form_helper_activerecord_test.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/actionview/test/activerecord/form_helper_activerecord_test.rb b/actionview/test/activerecord/form_helper_activerecord_test.rb index 0a9628da8d..0a62f49f35 100644 --- a/actionview/test/activerecord/form_helper_activerecord_test.rb +++ b/actionview/test/activerecord/form_helper_activerecord_test.rb @@ -59,12 +59,13 @@ class FormHelperActiveRecordTest < ActionView::TestCase protected def hidden_fields(method = nil) - txt = %{<div style="display:none">} - txt << %{<input name="utf8" type="hidden" value="✓" />} + txt = %{<input name="utf8" type="hidden" value="✓" />} + if method && !%w(get post).include?(method.to_s) txt << %{<input name="_method" type="hidden" value="#{method}" />} end - txt << %{</div>} + + txt end def form_text(action = "/", id = nil, html_class = nil, remote = nil, multipart = nil, method = nil) @@ -88,4 +89,4 @@ class FormHelperActiveRecordTest < ActionView::TestCase form_text(action, id, html_class, remote, multipart, method) + hidden_fields(method) + contents + "</form>" end -end
\ No newline at end of file +end |