add missing :before and :after callbacks for link_to_remote

This commit is contained in:
Stephen St. Martin
2010-01-24 12:59:29 -05:00
committed by Stefan Penner
parent 426a6b2e00
commit 133f6011d0
2 changed files with 6 additions and 1 deletions

View File

@@ -600,7 +600,7 @@ module ActionView
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

View File

@@ -86,6 +86,11 @@ class AjaxHelperTest < AjaxHelperBaseTest
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" })