Permalink
Browse files

Add support for HTML5 multiple files upload

  • Loading branch information...
j15e committed Jan 6, 2013
1 parent 9cd1143 commit 26aeb430af8c62a0d14ccd768ae97d4269414468
@@ -573,6 +573,7 @@ def radio_button_tag(name, options={})
#
# @api public
def file_field_tag(name, options={})
name = "#{name}[]" if options[:multiple]
options.reverse_merge!(:name => name)
input_tag(:file, options)
end
@@ -484,6 +484,11 @@ def app
assert_has_tag(:input, :type => 'file', :class => "photo", :name => 'photo') { actual_html }
end
should "have an array name with multiple option" do
actual_html = file_field_tag(:photos, :multiple => true)
assert_has_tag(:input, :name => 'photos[]') { actual_html }
end
should "display file field in erb" do
visit '/erb/form_tag'
assert_have_selector 'form.advanced-form input[type=file]', :count => 1, :name => 'photo', :class => 'upload'

0 comments on commit 26aeb43

Please sign in to comment.