1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/cgi/html.rb: allow symbolized key.

* test/cgi/test_cgi_tag_helper.rb: add a test.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19919 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
xibbar 2008-10-24 12:10:27 +00:00
parent 1e2b744ed2
commit b1c14f8fbb
3 changed files with 9 additions and 2 deletions

View file

@ -1,3 +1,9 @@
Fri Oct 24 21:05:38 2008 Takeyuki FUJIOKA <xibbar@ruby-lang.org>
* lib/cgi/html.rb: allow symbolized key.
* test/cgi/test_cgi_tag_helper.rb: add a test.
Fri Oct 24 20:54:53 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* common.mk (exts): renamed to get rid of the existent directory.

View file

@ -27,11 +27,11 @@ class CGI
attributes={attributes=>nil} if attributes.kind_of?(String)
"<#{element.upcase}" + attributes.collect{|name, value|
next unless value
" " + CGI::escapeHTML(name) +
" " + CGI::escapeHTML(name.to_s) +
if true == value
""
else
'="' + CGI::escapeHTML(value) + '"'
'="' + CGI::escapeHTML(value.to_s) + '"'
end
}.join + ">"
END

View file

@ -318,6 +318,7 @@ class CGITagHelperTest < Test::Unit::TestCase
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)
assert_match(/<INPUT .*TYPE="text".*>/,cgi.text_field(:name=>"name",:value=>"value"))
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)