aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/form_helper_test.rb
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2010-08-01 15:52:10 -0300
committerSantiago Pastorino <santiago@wyeworks.com>2010-08-01 21:51:54 -0300
commit11614bddc015deff7095bdf8bbe9f11e5d81ae1c (patch)
tree7a752b536ca821e79b9dd0acffceeaaef76c3ffb /actionpack/test/template/form_helper_test.rb
parentfb0bd8c1092db51888ec4bb72af6c595e13c31fa (diff)
downloadrails-11614bddc015deff7095bdf8bbe9f11e5d81ae1c.tar.gz
rails-11614bddc015deff7095bdf8bbe9f11e5d81ae1c.tar.bz2
rails-11614bddc015deff7095bdf8bbe9f11e5d81ae1c.zip
Fix label form helper to use I18n and html options, without the need of 'nil' text param:
Before: f.label :title, nil, :class => 'title' After : f.label :title, :class => 'title' [#5267 state:committed] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'actionpack/test/template/form_helper_test.rb')
-rw-r--r--actionpack/test/template/form_helper_test.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index f248a38ae9..9086a23345 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -120,6 +120,13 @@ class FormHelperTest < ActionView::TestCase
I18n.locale = old_locale
end
+ def test_label_with_locales_and_options
+ old_locale, I18n.locale = I18n.locale, :label
+ assert_dom_equal('<label for="post_body" class="post_body">Write entire text here</label>', label(:post, :body, :class => 'post_body'))
+ ensure
+ I18n.locale = old_locale
+ end
+
def test_label_with_for_attribute_as_symbol
assert_dom_equal('<label for="my_for">Title</label>', label(:post, :title, nil, :for => "my_for"))
end
@@ -620,7 +627,7 @@ class FormHelperTest < ActionView::TestCase
def test_form_for_with_symbol_object_name
form_for(@post, :as => "other_name", :html => { :id => 'create-post' }) do |f|
- concat f.label(:title)
+ concat f.label(:title, :class => 'post_title')
concat f.text_field(:title)
concat f.text_area(:body)
concat f.check_box(:secret)
@@ -628,7 +635,7 @@ class FormHelperTest < ActionView::TestCase
end
expected = whole_form("/posts/123", "create-post", "other_name_edit", :method => "put") do
- "<label for='other_name_title'>Title</label>" +
+ "<label for='other_name_title' class='post_title'>Title</label>" +
"<input name='other_name[title]' size='30' id='other_name_title' value='Hello World' type='text' />" +
"<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
"<input name='other_name[secret]' value='0' type='hidden' />" +