summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorxibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-28 15:41:12 +0000
committerxibbar <xibbar@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-28 15:41:12 +0000
commit9acff4872df1ab628abfae923691f911b58d6d3f (patch)
tree6cd27989dd3fbe6d36d3751c9faa54b189fe1b2a /test
parent645a0eb8ec7c71f7635207580e3fd90837e0d8cc (diff)
* lib/cgi/html.rb (CGI::HtmlExtension::{radio_group, checkbox_group}):
can specify the false as checked or selected value. [ruby-core:18306], [ruby-core:18307] * test/cgi/test_cgi_tag_helper.rb: add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rwxr-xr-xtest/cgi/test_cgi_tag_helper.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/cgi/test_cgi_tag_helper.rb b/test/cgi/test_cgi_tag_helper.rb
index 38533a11e80..618130b8223 100755
--- a/test/cgi/test_cgi_tag_helper.rb
+++ b/test/cgi/test_cgi_tag_helper.rb
@@ -313,6 +313,17 @@ class CGITagHelperTest < Test::Unit::TestCase
assert_match(/^<INPUT .*VALUE="aa".*>bb<INPUT .*VALUE="cc".*>dd$/,str)
assert_match(/^<INPUT .*TYPE="radio".*>bb<INPUT .*TYPE="radio".*>dd$/,str)
assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
+ str=cgi.checkbox_group("foo",["aa","bb"],["cc","dd",true])
+ assert_match(/^<INPUT .*VALUE="aa".*>bb<INPUT .*VALUE="cc".*>dd$/,str)
+ assert_match(/^<INPUT .*TYPE="checkbox".*>bb<INPUT .*TYPE="checkbox".*>dd$/,str)
+ assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
+ assert_match(/^<INPUT .*>bb<INPUT .*CHECKED.*>dd$/,str)
+ if RUBY_VERSION>="1.9"
+ str=cgi.radio_group("foo",["aa","bb"],["cc","dd",false])
+ assert_match(/^<INPUT .*VALUE="aa".*>bb<INPUT .*VALUE="cc".*>dd$/,str)
+ assert_match(/^<INPUT .*TYPE="radio".*>bb<INPUT .*TYPE="radio".*>dd$/,str)
+ assert_match(/^<INPUT .*NAME="foo".*>bb<INPUT .*NAME="foo".*>dd$/,str)
+ end
end
=begin