diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-24 15:35:30 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-24 15:35:30 +0000 |
commit | b69d33752703b36c1b8b5ccf043fd80a5d323d82 (patch) | |
tree | 27140d89672f195c3c35bed5a7e64fbc421b7c06 /actionpack/test | |
parent | d071deeecd9e176b09720aa9e9ca79bb9a8319fd (diff) | |
download | rails-b69d33752703b36c1b8b5ccf043fd80a5d323d82.tar.gz rails-b69d33752703b36c1b8b5ccf043fd80a5d323d82.tar.bz2 rails-b69d33752703b36c1b8b5ccf043fd80a5d323d82.zip |
Applied the dblack patch
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@499 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_helper_test.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/test/template/form_helper_test.rb b/actionpack/test/template/form_helper_test.rb index c6128a9337..6b1deb575e 100644 --- a/actionpack/test/template/form_helper_test.rb +++ b/actionpack/test/template/form_helper_test.rb @@ -18,6 +18,8 @@ class FormHelperTest < Test::Unit::TestCase @post = Post.new def @post.errors() Class.new{ def on(field) field == "author_name" end }.new end + def @post.id; 123; end + @post.title = "Hello World" @post.author_name = "" @post.body = "Back to the hill and over it again!" @@ -136,4 +138,28 @@ class FormHelperTest < Test::Unit::TestCase check_box("post", "secret", "id" => "i mean it") ) end + + def test_auto_index + pid = @post.id + assert_equal( + "<input id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" size=\"30\" type=\"text\" value=\"Hello World\" />", text_field("post[]","title") + ) + assert_equal( + "<textarea cols=\"40\" id=\"post_#{pid}_body\" name=\"post[#{pid}][body]\" rows=\"20\" wrap=\"virtual\">Back to the hill and over it again!</textarea>", + text_area("post[]", "body") + ) + assert_equal( + "<input checked=\"checked\" id=\"post_#{pid}_secret\" name=\"post[#{pid}][secret]\" type=\"checkbox\" value=\"1\" /><input name=\"post[#{pid}][secret]\" type=\"hidden\" value=\"0\" />", + check_box("post[]", "secret") + ) + assert_equal( +"<input checked=\"checked\" id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" size=\"30\" type=\"radio\" value=\"Hello World\" />", + radio_button("post[]", "title", "Hello World") + ) + assert_equal("<input id=\"post_#{pid}_title\" name=\"post[#{pid}][title]\" size=\"30\" type=\"radio\" value=\"Goodbye World\" />", + radio_button("post[]", "title", "Goodbye World") + ) + + end + end |