diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-06 11:50:41 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-03-06 11:50:41 +0000 |
commit | dfac1cea3d851000116a23ab14c2b1ae981f7a12 (patch) | |
tree | 91abe3727d19f4c13affe1a2e4bc4637b35d5fdf /actionpack/test/template/url_helper_test.rb | |
parent | db41d2dd5c738ca44a07330cf02e9d817fedc34c (diff) | |
download | rails-dfac1cea3d851000116a23ab14c2b1ae981f7a12.tar.gz rails-dfac1cea3d851000116a23ab14c2b1ae981f7a12.tar.bz2 rails-dfac1cea3d851000116a23ab14c2b1ae981f7a12.zip |
Fixed that form helpers would treat string and symbol keys differently in html_options (and possibly create duplicate entries) #112 [bitsweat]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@833 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/url_helper_test.rb')
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 6e94d98ebe..379db0b9b7 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -21,26 +21,31 @@ class UrlHelperTest < Test::Unit::TestCase def test_link_tag_with_straight_url assert_equal "<a href=\"http://www.world.com\">Hello</a>", link_to("Hello", "http://www.world.com") end - + def test_link_tag_with_javascript_confirm assert_equal( - "<a href=\"http://www.world.com\" onclick=\"return confirm('Are you sure?');\">Hello</a>", + "<a href=\"http://www.world.com\" onclick=\"return confirm('Are you sure?');\">Hello</a>", link_to("Hello", "http://www.world.com", :confirm => "Are you sure?") ) end - + def test_link_to_image assert_equal( - "<a href=\"http://www.world.com\"><img alt=\"Rss\" border=\"0\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>", + "<a href=\"http://www.world.com\"><img alt=\"Rss\" border=\"0\" height=\"45\" src=\"/images/rss.png\" width=\"30\" /></a>", link_to_image("rss", "http://www.world.com", "size" => "30x45") ) assert_equal( - "<a class=\"admin\" href=\"http://www.world.com\"><img alt=\"Feed\" border=\"0\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>", + "<a class=\"admin\" href=\"http://www.world.com\"><img alt=\"Feed\" border=\"0\" height=\"45\" src=\"/images/rss.gif\" width=\"30\" /></a>", link_to_image("rss.gif", "http://www.world.com", "size" => "30x45", "alt" => "Feed", "class" => "admin") ) + + assert_equal link_to_image("rss", "http://www.world.com", "size" => "30x45"), + link_to_image("rss", "http://www.world.com", :size => "30x45") + assert_equal link_to_image("rss.gif", "http://www.world.com", "size" => "30x45", "alt" => "Feed", "class" => "admin"), + link_to_image("rss.gif", "http://www.world.com", :size => "30x45", :alt => "Feed", :class => "admin") end - + def test_link_unless_current @request = RequestMock.new("http://www.world.com") assert_equal "Showing", link_to_unless_current("Showing", :action => "show", :controller => "weblog") @@ -55,11 +60,13 @@ class UrlHelperTest < Test::Unit::TestCase assert_equal "<a href=\"mailto:david@loudthinking.com\">david@loudthinking.com</a>", mail_to("david@loudthinking.com") assert_equal "<a href=\"mailto:david@loudthinking.com\">David Heinemeier Hansson</a>", mail_to("david@loudthinking.com", "David Heinemeier Hansson") assert_equal( - "<a class=\"admin\" href=\"mailto:david@loudthinking.com\">David Heinemeier Hansson</a>", + "<a class=\"admin\" href=\"mailto:david@loudthinking.com\">David Heinemeier Hansson</a>", mail_to("david@loudthinking.com", "David Heinemeier Hansson", "class" => "admin") ) + assert_equal mail_to("david@loudthinking.com", "David Heinemeier Hansson", "class" => "admin"), + mail_to("david@loudthinking.com", "David Heinemeier Hansson", :class => "admin") end - + def test_link_with_nil_html_options assert_equal "<a href=\"http://www.world.com\">Hello</a>", link_to("Hello", {:action => 'myaction'}, nil) end |