Browse files

add missing test for :with option to link_to_remote

  • Loading branch information...
1 parent 9e3e1b3 commit a5e9d033e81152e1b2280042ba6289c8a231e8bf @stevestmartin stevestmartin committed with stefanpenner Jan 24, 2010
Showing with 6 additions and 0 deletions.
  1. +6 −0 actionpack/test/template/ajax_helper_test.rb
View
6 actionpack/test/template/ajax_helper_test.rb
@@ -90,6 +90,12 @@ def setup
assert_dom_equal %(<a href=\"#\" data-remote=\"true\" data-url=\"http://www.example.com/whatnot\" data-onbefore=\"before();\" data-onafter=\"after();\">Remote outauthor</a>),
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :before => "before();", :after => "after();")
end
+
+ test "link_to_remote using :with expression" do
+ expected = %(<a href=\"#\" data-remote=\"true\" data-url=\"http://www.example.com/whatnot\" data-with=\"'id=' + encodeURIComponent(value)\">Remote outauthor</a>)
+ assert_dom_equal expected, link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :with => "id")
+ assert_dom_equal expected, link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :with => "'id=' + encodeURIComponent(value)")
+ end
test "link_to_remote with method delete" do
assert_dom_equal %(<a class=\"fine\" href=\"#\" data-remote=\"true\" data-url=\"http://www.example.com/whatnot\" data-method=\"delete\" rel=\"nofollow\">Remote outauthor</a>),

0 comments on commit a5e9d03

Please sign in to comment.