From a14df8c9b26b489f1db8fba64c72da3f20af7fcd Mon Sep 17 00:00:00 2001 From: David Stevenson Date: Wed, 11 Mar 2009 09:28:56 -0700 Subject: Made label target radio button tags with values. Radio button now respects inherited :index options when generating id. Signed-off-by: Michael Koziarski --- actionpack/test/template/form_helper_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index 104649deac..947668ccc6 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -99,6 +99,11 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal('', label(:post, :title, nil, "for" => "my_for")) end + def test_label_for_radio_buttons_with_value + assert_dom_equal('', label("post", "title", "The title goes here", :value => "great_title")) + assert_dom_equal('', label("post", "title", "The title goes here", :value => "great title")) + end + def test_text_field assert_dom_equal( '', text_field("post", "title") @@ -532,6 +537,20 @@ class FormHelperTest < ActionView::TestCase assert_dom_equal expected, output_buffer end + def test_nested_fields_for_with_index_radio_button + form_for(:post, @post) do |f| + f.fields_for(:comment, @post, :index => 5) do |c| + concat c.radio_button(:title, "hello") + end + end + + expected = "
" + + "" + + "
" + + assert_dom_equal expected, output_buffer + end + def test_nested_fields_for_with_auto_index_on_both form_for("post[]", @post) do |f| f.fields_for("comment[]", @post) do |c| -- cgit v1.2.3