diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 12:49:14 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-19 12:49:14 +0000 |
commit | 967339e4d324daa659e5f625d48a56dc17d5287e (patch) | |
tree | fb8caefc05b1bb604e49941c66890725ceedbd5c /actionpack/test | |
parent | b6854c648bfb08d760f4adf860148783a0015dee (diff) | |
download | rails-967339e4d324daa659e5f625d48a56dc17d5287e.tar.gz rails-967339e4d324daa659e5f625d48a56dc17d5287e.tar.bz2 rails-967339e4d324daa659e5f625d48a56dc17d5287e.zip |
Added FormTagHelper that provides a number of methods for creating form tags that doesn't rely on conventions with an object assigned to the template like FormHelper does. With the FormTagHelper, you provide the names and values yourself.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@687 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test')
-rw-r--r-- | actionpack/test/template/form_tag_helper_test.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb new file mode 100644 index 0000000000..5806c879fd --- /dev/null +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -0,0 +1,19 @@ +require 'test/unit' +require File.dirname(__FILE__) + '/../../lib/action_view/helpers/form_tag_helper' + +class TagHelperTest < Test::Unit::TestCase + include ActionView::Helpers::TagHelper + include ActionView::Helpers::FormTagHelper + + MethodToTag = { + %(text_field_tag("title", "Hello!")) => %(<input id="title" name="title" type="text" value="Hello!" />), + %(text_field_tag("title", "Hello!", "class" => "admin")) => %(<input class="admin" id="title" name="title" type="text" value="Hello!" />), + %(password_field_tag) => %(<input id="password" name="password" type="password" value="" />), + %(text_area_tag("body", "hello world", :size => "20x40")) => %(<textarea cols="20" id="body" name="body" rows="40">hello world</textarea>), + %(check_box_tag("admin")) => %(<input id="admin" name="admin" type="checkbox" value="1" />), + } + + def test_tags + MethodToTag.each { |method, tag| assert_equal(eval(method), tag) } + end +end
\ No newline at end of file |