mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
remove size attribute from tag generated by file_field helper [#5084 state:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
This commit is contained in:
parent
b520d602ff
commit
d2fae5f78e
2 changed files with 6 additions and 1 deletions
|
@ -676,7 +676,7 @@ module ActionView
|
||||||
# # => <input type="file" id="attachment_file" name="attachment[file]" class="file_input" />
|
# # => <input type="file" id="attachment_file" name="attachment[file]" class="file_input" />
|
||||||
#
|
#
|
||||||
def file_field(object_name, method, options = {})
|
def file_field(object_name, method, options = {})
|
||||||
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("file", options)
|
InstanceTag.new(object_name, method, self, options.delete(:object)).to_input_field_tag("file", options.update({:size => nil}))
|
||||||
end
|
end
|
||||||
|
|
||||||
# Returns a textarea opening and closing tag set tailored for accessing a specified attribute (identified by +method+)
|
# Returns a textarea opening and closing tag set tailored for accessing a specified attribute (identified by +method+)
|
||||||
|
|
|
@ -200,6 +200,11 @@ class FormHelperTest < ActionView::TestCase
|
||||||
assert_equal object_name, "post[]"
|
assert_equal object_name, "post[]"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_file_field_has_no_size
|
||||||
|
expected = '<input id="user_avatar" name="user[avatar]" type="file" />'
|
||||||
|
assert_dom_equal expected, file_field("user", "avatar")
|
||||||
|
end
|
||||||
|
|
||||||
def test_hidden_field
|
def test_hidden_field
|
||||||
assert_dom_equal '<input id="post_title" name="post[title]" type="hidden" value="Hello World" />',
|
assert_dom_equal '<input id="post_title" name="post[title]" type="hidden" value="Hello World" />',
|
||||||
hidden_field("post", "title")
|
hidden_field("post", "title")
|
||||||
|
|
Loading…
Reference in a new issue