Permalink
Browse files

add missing :before and :after callbacks for link_to_remote

  • Loading branch information...
stevestmartin authored and stefanpenner committed Jan 24, 2010
1 parent 426a6b2 commit 133f6011d08ee043dcb5ae95bb441a81f6206bd9
@@ -600,7 +600,7 @@ def form_remote_tag(options, &block)
private
def set_callbacks(options, html)
- [:uninitialized, :complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
+ [:before, :after, :uninitialized, :complete, :failure, :success, :interactive, :loaded, :loading].each do |type|
html["data-on#{type}"] = options.delete(type.to_sym)
end
@@ -86,6 +86,11 @@ def setup
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom)
end
+ test "link_to_remote with before/after callbacks" do
+ 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 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>),
link_to_remote("Remote outauthor", { :url => { :action => "whatnot" }, :method => "delete"}, { :class => "fine" })

0 comments on commit 133f601

Please sign in to comment.