aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorStefan Penner <stefan.penner@gmail.com>2010-01-26 14:08:10 -0600
committerStefan Penner <stefan.penner@gmail.com>2010-01-27 12:44:35 -0600
commit1b8ced53c4031170538c455c3d3fae3c967cc247 (patch)
treec2947103b338711ed2b62317ab37d1f7cd2db274 /actionpack
parentc0f63883ea24925d4e03c258b874e49cf507cc33 (diff)
downloadrails-1b8ced53c4031170538c455c3d3fae3c967cc247.tar.gz
rails-1b8ced53c4031170538c455c3d3fae3c967cc247.tar.bz2
rails-1b8ced53c4031170538c455c3d3fae3c967cc247.zip
Added regression tests that discovered the previous issue.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/test/template/ajax_helper_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/actionpack/test/template/ajax_helper_test.rb b/actionpack/test/template/ajax_helper_test.rb
index 4e48543c81..ed020d74f8 100644
--- a/actionpack/test/template/ajax_helper_test.rb
+++ b/actionpack/test/template/ajax_helper_test.rb
@@ -86,6 +86,20 @@ class AjaxHelperTest < AjaxHelperBaseTest
link_to_remote("Remote outauthor", :url => { :action => "whatnot" }, :position => :bottom)
end
+ test "link_to_remote using both url and href" do
+ expected = '<a href="http://www.example.com/destroy" data-url="http://www.example.com/destroy" data-update-success="posts" data-remote="true">Delete this Post</a>'
+ assert_dom_equal expected, link_to_remote( "Delete this Post",
+ { :update => "posts",
+ :url => { :action => "destroy" } },
+ :href => url_for(:action => "destroy"))
+ end
+
+ test "link_to_remote with update-success and url" do
+ expected = '<a href="#" data-url="http://www.example.com/destroy" data-update-success="posts" data-update-failure="error" data-remote="true">Delete this Post</a>'
+ assert_dom_equal expected, link_to_remote( "Delete this Post", :url => { :action => "destroy", :id => 5 },
+ :update => { :success => "posts", :failure => "error" })
+ 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();")