aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test
diff options
context:
space:
mode:
authorMatt Duncan <mrduncan@gmail.com>2009-08-08 11:50:17 -0400
committerPratik Naik <pratiknaik@gmail.com>2009-08-09 23:54:21 +0100
commit920ef4e6f3832ea1d3297e2e7e5f0f775dab69a8 (patch)
tree1fd7224650426594059ca6888423d3eb72a41e5c /actionpack/test
parente391c7a97cdefa172fcba214fb0a6cd3bd5b0bf4 (diff)
downloadrails-920ef4e6f3832ea1d3297e2e7e5f0f775dab69a8.tar.gz
rails-920ef4e6f3832ea1d3297e2e7e5f0f775dab69a8.tar.bz2
rails-920ef4e6f3832ea1d3297e2e7e5f0f775dab69a8.zip
Fixed to_label_tag to accept id attribute without changing for attribute [#2660 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'actionpack/test')
-rw-r--r--actionpack/test/template/form_helper_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb
index 2b1d80b1bf..8fd018f86d 100644
--- a/actionpack/test/template/form_helper_test.rb
+++ b/actionpack/test/template/form_helper_test.rb
@@ -157,6 +157,22 @@ class FormHelperTest < ActionView::TestCase
assert_dom_equal('<label for="my_for">Title</label>', label(:post, :title, nil, "for" => "my_for"))
end
+ def test_label_with_id_attribute_as_symbol
+ assert_dom_equal('<label for="post_title" id="my_id">Title</label>', label(:post, :title, nil, :id => "my_id"))
+ end
+
+ def test_label_with_id_attribute_as_string
+ assert_dom_equal('<label for="post_title" id="my_id">Title</label>', label(:post, :title, nil, "id" => "my_id"))
+ end
+
+ def test_label_with_for_and_id_attributes_as_symbol
+ assert_dom_equal('<label for="my_for" id="my_id">Title</label>', label(:post, :title, nil, :for => "my_for", :id => "my_id"))
+ end
+
+ def test_label_with_for_and_id_attributes_as_string
+ assert_dom_equal('<label for="my_for" id="my_id">Title</label>', label(:post, :title, nil, "for" => "my_for", "id" => "my_id"))
+ end
+
def test_label_for_radio_buttons_with_value
assert_dom_equal('<label for="post_title_great_title">The title goes here</label>', label("post", "title", "The title goes here", :value => "great_title"))
assert_dom_equal('<label for="post_title_great_title">The title goes here</label>', label("post", "title", "The title goes here", :value => "great title"))