1
0
Fork 0
mirror of https://github.com/teamcapybara/capybara.git synced 2022-11-09 12:08:07 -05:00

Do not add additional carriage returns to CR+LF in textareas with rack_test

This commit is contained in:
Stefan Hoffmann 2022-05-06 15:51:15 +02:00 committed by Stefan Hoffmann
parent 98e367d9f9
commit 9122dd108f
No known key found for this signature in database
GPG key ID: A2E8A105A8D1DB3C
2 changed files with 7 additions and 1 deletions

View file

@ -120,7 +120,7 @@ private
end end
def add_textarea_param(field, params) def add_textarea_param(field, params)
merge_param!(params, field['name'], field['_capybara_raw_value'].to_s.gsub(/\n/, "\r\n")) merge_param!(params, field['name'], field['_capybara_raw_value'].to_s.gsub(/\r?\n/, "\r\n"))
end end
def submitter?(el) def submitter?(el)

View file

@ -98,6 +98,12 @@ Capybara::SpecHelper.spec '#fill_in' do
expect(extract_results(@session)['description']).to eq("\r\nSome text\r\n") expect(extract_results(@session)['description']).to eq("\r\nSome text\r\n")
end end
it 'should handle carriage returns with line feeds in a textarea correct' do
@session.fill_in('form_description', with: "\r\nSome text\r\n")
@session.click_button('awesome')
expect(extract_results(@session)['description']).to eq("\r\nSome text\r\n")
end
it 'should fill in a color field' do it 'should fill in a color field' do
@session.fill_in('Html5 Color', with: '#112233') @session.fill_in('Html5 Color', with: '#112233')
@session.click_button('html5_submit') @session.click_button('html5_submit')