diff options
author | Nicholas Seckar <nseckar@gmail.com> | 2006-03-22 19:41:39 +0000 |
---|---|---|
committer | Nicholas Seckar <nseckar@gmail.com> | 2006-03-22 19:41:39 +0000 |
commit | c05c22a45f9332f50eb6efae5a393268f6b6609d (patch) | |
tree | aded989d9cb75e5a8a5bec5bc4763e860de7240c /actionpack/test/template | |
parent | 2d24bed3a072aac1a0087ec4c4681889e49ea6a4 (diff) | |
download | rails-c05c22a45f9332f50eb6efae5a393268f6b6609d.tar.gz rails-c05c22a45f9332f50eb6efae5a393268f6b6609d.tar.bz2 rails-c05c22a45f9332f50eb6efae5a393268f6b6609d.zip |
Fix double url escaping of remote_function. Add :escape => false option to ActionView's url_for.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4014 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/prototype_helper_test.rb | 4 | ||||
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 2 |
2 files changed, 6 insertions, 0 deletions
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb index 71ba44d227..ceeb418e34 100644 --- a/actionpack/test/template/prototype_helper_test.rb +++ b/actionpack/test/template/prototype_helper_test.rb @@ -16,6 +16,8 @@ module BaseTest def url_for(options, *parameters_for_method_reference) url = "http://www.example.com/" url << options[:action].to_s if options and options[:action] + url << "?a=#{options[:a]}" if options && options[:a] + url << "&b=#{options[:b]}" if options && options[:a] && options[:b] url end end.new @@ -40,6 +42,8 @@ class PrototypeHelperTest < Test::Unit::TestCase link_to_remote("Remote outpost", :success => "alert(request.reponseText)", :url => { :action => "whatnot" }) assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>), link_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot" }) + assert_dom_equal %(<a href=\"#\" onclick=\"new Ajax.Request('http://www.example.com/whatnot?a=10&b=20', {asynchronous:true, evalScripts:true, onFailure:function(request){alert(request.reponseText)}}); return false;\">Remote outpost</a>), + link_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot", :a => '10', :b => '20' }) end def test_periodically_call_remote diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 2c7a526315..231e34751e 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -25,6 +25,8 @@ class UrlHelperTest < Test::Unit::TestCase def test_url_for_escapes_urls @controller.url = "http://www.example.com?a=b&c=d" assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd') + assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd', :escape => true) + assert_equal "http://www.example.com?a=b&c=d", url_for(:a => 'b', :c => 'd', :escape => false) end # todo: missing test cases |