Turns out we don't have to exclude @multiple after all but merely @type='file'. Now includes specs that pass with this change and fail without it.
This commit is contained in:
parent
d6760e4d86
commit
4cfe882c98
|
@ -113,7 +113,7 @@ class Capybara::Driver::RackTest < Capybara::Driver::Base
|
|||
def params(button)
|
||||
params = {}
|
||||
|
||||
native.xpath(".//input[not(@disabled) and (not(@type) or (@type!='radio' and not(@type='file' and @multiple) and @type!='checkbox' and @type!='submit' and @type!='image'))]").map do |input|
|
||||
native.xpath(".//input[not(@disabled) and (not(@type) or (@type!='radio' and @type!='file' and @type!='checkbox' and @type!='submit' and @type!='image'))]").map do |input|
|
||||
merge_param!(params, input['name'].to_s, input['value'].to_s)
|
||||
end
|
||||
native.xpath(".//textarea[not(@disabled)]").map do |textarea|
|
||||
|
|
|
@ -53,6 +53,12 @@ shared_examples_for "attach_file" do
|
|||
@session.click_button 'Upload'
|
||||
@session.body.should include('image/jpeg')
|
||||
end
|
||||
|
||||
it "should not break when using HTML5 multiple file input" do
|
||||
@session.attach_file "Multiple Documents", @test_file_path
|
||||
@session.click_button('Upload Multiple')
|
||||
@session.body.should include(File.read(@test_file_path))
|
||||
end
|
||||
end
|
||||
|
||||
context "with a locator that doesn't exist" do
|
||||
|
|
|
@ -87,6 +87,17 @@ class TestApp < Sinatra::Base
|
|||
'No file uploaded'
|
||||
end
|
||||
end
|
||||
|
||||
post '/upload_multiple' do
|
||||
begin
|
||||
buffer = []
|
||||
buffer << "Content-type: #{params[:form][:multiple_documents][0][:type]}"
|
||||
buffer << "File content: #{params[:form][:multiple_documents][0][:tempfile].read}"
|
||||
buffer.join(' | ')
|
||||
rescue
|
||||
'No files uploaded'
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
|
|
|
@ -266,6 +266,22 @@
|
|||
<p>
|
||||
</form>
|
||||
|
||||
<form action="/upload_multiple" method="post" enctype="multipart/form-data">
|
||||
<p>
|
||||
<label for="form_multiple_file_name">File Name</label>
|
||||
<input type="file" name="form[multiple_file_name]" id="form_multiple_file_name"/>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<label for="form_multiple_documents">Multiple Documents</label>
|
||||
<input type="file" name="form[multiple_documents][]" id="form_multiple_documents" multiple />
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<input type="submit" value="Upload Multiple"/>
|
||||
<p>
|
||||
</form>
|
||||
|
||||
<form action="/redirect" method="post">
|
||||
<p>
|
||||
<input type="submit" value="Go FAR"/>
|
||||
|
|
Loading…
Reference in New Issue