@@ -120,6 +120,13 @@ def test_label_with_locales_symbols
120120 I18n . locale = old_locale
121121 end
122122
123+ def test_label_with_locales_and_options
124+ old_locale , I18n . locale = I18n . locale , :label
125+ assert_dom_equal ( '<label for="post_body" class="post_body">Write entire text here</label>' , label ( :post , :body , :class => 'post_body' ) )
126+ ensure
127+ I18n . locale = old_locale
128+ end
129+
123130 def test_label_with_for_attribute_as_symbol
124131 assert_dom_equal ( '<label for="my_for">Title</label>' , label ( :post , :title , nil , :for => "my_for" ) )
125132 end
@@ -620,15 +627,15 @@ def test_form_for
620627
621628 def test_form_for_with_symbol_object_name
622629 form_for ( @post , :as => "other_name" , :html => { :id => 'create-post' } ) do |f |
623- concat f . label ( :title )
630+ concat f . label ( :title , :class => 'post_title' )
624631 concat f . text_field ( :title )
625632 concat f . text_area ( :body )
626633 concat f . check_box ( :secret )
627634 concat f . submit ( 'Create post' )
628635 end
629636
630637 expected = whole_form ( "/posts/123" , "create-post" , "other_name_edit" , :method => "put" ) do
631- "<label for='other_name_title'>Title</label>" +
638+ "<label for='other_name_title' class='post_title' >Title</label>" +
632639 "<input name='other_name[title]' size='30' id='other_name_title' value='Hello World' type='text' />" +
633640 "<textarea name='other_name[body]' id='other_name_body' rows='20' cols='40'>Back to the hill and over it again!</textarea>" +
634641 "<input name='other_name[secret]' value='0' type='hidden' />" +
0 commit comments