aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template
diff options
context:
space:
mode:
authorAlexey Vakhov <vakhov@gmail.com>2012-04-01 00:52:48 +0400
committerAlexey Vakhov <vakhov@gmail.com>2012-04-01 08:53:55 +0400
commit889bb4b786941fa2e73163e0b0de10175a999526 (patch)
tree83ca7597874eaaa05081be848062a0fc8a3f7e4b /actionpack/test/template
parent0244c0d8f339385a9b420a0565b17d327bf25b13 (diff)
downloadrails-889bb4b786941fa2e73163e0b0de10175a999526.tar.gz
rails-889bb4b786941fa2e73163e0b0de10175a999526.tar.bz2
rails-889bb4b786941fa2e73163e0b0de10175a999526.zip
Block version of label should wrapped in field_with_errors in case of error
Diffstat (limited to 'actionpack/test/template')
-rw-r--r--actionpack/test/template/form_helper_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 7b684822fc..f13296a175 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -1080,6 +1080,20 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal expected, output_buffer
end
+ def test_form_for_label_error_wrapping_block_and_non_block_versions
+ form_for(@post) do |f|
+ concat f.label(:author_name, 'Name', :class => 'label')
+ concat f.label(:author_name, :class => 'label') { 'Name' }
+ end
+
+ expected = whole_form('/posts/123', 'edit_post_123' , 'edit_post', 'patch') do
+ "<div class='field_with_errors'><label for='post_author_name' class='label'>Name</label></div>" +
+ "<div class='field_with_errors'><label for='post_author_name' class='label'>Name</label></div>"
+ end
+
+ assert_dom_equal expected, output_buffer
+ end
+
def test_form_for_with_namespace
form_for(@post, :namespace => 'namespace') do |f|
concat f.text_field(:title)