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

Merge pull request #2547 from adigi-ai/fix-carriage-returns-in-rack-test

Rack-test driver adds additional carriage return to CR+LF in textareas
This commit is contained in:
Thomas Walpole 2022-05-14 12:37:58 -07:00 committed by GitHub
commit 270f7b4f71
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -120,7 +120,7 @@ private
end
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
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")
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
@session.fill_in('Html5 Color', with: '#112233')
@session.click_button('html5_submit')