aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/ajax_helper_test.rb
diff options
context:
space:
mode:
authorErik St. Martin <alakriti@gmail.com>2010-01-24 09:57:09 -0500
committerStefan Penner <stefan.penner@gmail.com>2010-01-27 12:44:33 -0600
commitc3baf8b767bdfb27b90b2120f9512d9697e5e932 (patch)
tree6fe4e759a02d7bac029e9673597a10ef320aa8f4 /actionpack/test/template/ajax_helper_test.rb
parent9ad8d348b52e5603bb2432ee7fe326142ce5084b (diff)
downloadrails-c3baf8b767bdfb27b90b2120f9512d9697e5e932.tar.gz
rails-c3baf8b767bdfb27b90b2120f9512d9697e5e932.tar.bz2
rails-c3baf8b767bdfb27b90b2120f9512d9697e5e932.zip
link_to_remote and button_to_remote now support :confirm
Diffstat (limited to 'actionpack/test/template/ajax_helper_test.rb')
-rw-r--r--actionpack/test/template/ajax_helper_test.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/actionpack/test/template/ajax_helper_test.rb b/actionpack/test/template/ajax_helper_test.rb
index 77d1510bab..095454977e 100644
--- a/actionpack/test/template/ajax_helper_test.rb
+++ b/actionpack/test/template/ajax_helper_test.rb
@@ -101,6 +101,11 @@ class AjaxHelperTest < AjaxHelperBaseTest
link_to_remote("Remote", { :url => { :action => "whatnot's" } })
end
+ test "link_to_remote with confirm" do
+ assert_dom_equal %(<a class=\"fine\" href=\"#\" data-remote=\"true\" data-url=\"http://www.example.com/whatnot\" data-method=\"delete\" rel=\"nofollow\" data-confirm="Are you sure?">Remote confirm</a>),
+ link_to_remote("Remote confirm", { :url => { :action => "whatnot" }, :method => "delete", :confirm => "Are you sure?"}, { :class => "fine" })
+ end
+
test "button_to_remote" do
assert_dom_equal %(<input class=\"fine\" type=\"button\" value=\"Remote outpost\" data-remote=\"true\" data-url=\"http://www.example.com/whatnot\" />),
button_to_remote("Remote outpost", { :url => { :action => "whatnot" }}, { :class => "fine" })
@@ -114,6 +119,11 @@ class AjaxHelperTest < AjaxHelperBaseTest
button_to_remote("Remote outpost", :failure => "alert(request.reponseText)", :url => { :action => "whatnot", :a => '10', :b => '20' })
end
+ test "button_to_remote with confirm" do
+ assert_dom_equal %(<input class=\"fine\" type=\"button\" value=\"Remote outpost\" data-remote=\"true\" data-url=\"http://www.example.com/whatnot\" data-confirm="Are you sure?" />),
+ button_to_remote("Remote outpost", { :url => { :action => "whatnot" }, :confirm => "Are you sure?"}, { :class => "fine" })
+ end
+
test "periodically_call_remote" do
assert_dom_equal %(<script data-url=\"http://www.example.com/mehr_bier\" data-observe=\"true\" data-update-success=\"schremser_bier\" type=\"application/json\" data-periodical=\"true\"></script>),
periodically_call_remote(:update => "schremser_bier", :url => { :action => "mehr_bier" })