mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Fix that label_tag doesn't take a symbol for a name. [#719 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
This commit is contained in:
parent
2cf161a384
commit
7aaf1689dd
2 changed files with 7 additions and 1 deletions
|
@ -129,7 +129,7 @@ module ActionView
|
|||
# label_tag 'name', nil, :class => 'small_label'
|
||||
# # => <label for="name" class="small_label">Name</label>
|
||||
def label_tag(name, text = nil, options = {})
|
||||
content_tag :label, text || name.humanize, { "for" => name }.update(options.stringify_keys)
|
||||
content_tag :label, text || name.to_s.humanize, { "for" => name }.update(options.stringify_keys)
|
||||
end
|
||||
|
||||
# Creates a hidden form input field used to transmit data that would be lost due to HTTP's statelessness or
|
||||
|
|
|
@ -190,6 +190,12 @@ class FormTagHelperTest < ActionView::TestCase
|
|||
assert_dom_equal expected, actual
|
||||
end
|
||||
|
||||
def test_label_tag_with_symbol
|
||||
actual = label_tag :title
|
||||
expected = %(<label for="title">Title</label>)
|
||||
assert_dom_equal expected, actual
|
||||
end
|
||||
|
||||
def test_label_tag_with_text
|
||||
actual = label_tag "title", "My Title"
|
||||
expected = %(<label for="title">My Title</label>)
|
||||
|
|
Loading…
Reference in a new issue