diff options
author | David Stevenson <david@flouri.sh> | 2009-03-11 09:28:56 -0700 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2009-06-09 20:28:43 +1200 |
commit | a14df8c9b26b489f1db8fba64c72da3f20af7fcd (patch) | |
tree | bcbd3c15e4185c556b576594efaa34798005acbe /actionpack/test/template | |
parent | 63091cef2eeed500c1cf930f04e653b269abe12b (diff) | |
download | rails-a14df8c9b26b489f1db8fba64c72da3f20af7fcd.tar.gz rails-a14df8c9b26b489f1db8fba64c72da3f20af7fcd.tar.bz2 rails-a14df8c9b26b489f1db8fba64c72da3f20af7fcd.zip |
Made label target radio button tags with values. Radio button now respects inherited :index options when generating id.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
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 for="my_for">Title</label>', label(:post, :title, nil, "for" => "my_for")) 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")) + end + def test_text_field assert_dom_equal( '<input id="post_title" name="post[title]" size="30" type="text" value="Hello World" />', 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 = "<form action='http://www.example.com' method='post'>" + + "<input name='post[comment][5][title]' type='radio' id='post_comment_5_title_hello' value='hello' />" + + "</form>" + + 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| |