Skip to content

Commit

Permalink
Use textarea in textarea specs only
Browse files Browse the repository at this point in the history
Use a simple text field instead of the more complex textarea in specs
that are not related to textarea.

This will simplify the test suite and prevent unrelated failures

Ref: #941
  • Loading branch information
tagliala committed Aug 8, 2024
1 parent 6321a72 commit 659633c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/action_view/cases/test_form_for_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ def test_not_embed_authenticity_token_in_remote_forms
::ActionView::Helpers::FormTagHelper.embed_authenticity_token_in_remote_forms = false

form_for(@post, validate: true, remote: true) do |f|
concat f.text_area(:cost)
concat f.text_field(:cost)
end

validators = { 'post[cost]' => { presence: [{ message: I18n.t('errors.messages.blank') }] } }
expected = whole_form_for('/posts', 'new_post', 'new_post', validators: validators, remote: true) do
form_field('textarea', id: 'post_cost', name: 'post[cost]', tag_content: "\n")
form_field('input', id: 'post_cost', name: 'post[cost]', type: 'text')
end

assert_dom_equal expected, output_buffer
Expand All @@ -45,13 +45,13 @@ def test_not_embed_authenticity_token_in_remote_forms

def test_http_method
form_for(@post, validate: true, method: :patch) do |f|
concat f.text_area(:cost)
concat f.text_field(:cost)
end

validators = { 'post[cost]' => { presence: [{ message: I18n.t('errors.messages.blank') }] } }
expected = whole_form_for('/posts', 'new_post', 'new_post', validators: validators) do
form_field('input', name: '_method', type: 'hidden', value: 'patch') +
form_field('textarea', id: 'post_cost', name: 'post[cost]', tag_content: "\n")
form_field('input', id: 'post_cost', name: 'post[cost]', type: 'text')
end

assert_dom_equal expected, output_buffer
Expand Down

0 comments on commit 659633c

Please sign in to comment.