diff options
author | Carlos Galdino <carloshsgaldino@gmail.com> | 2012-06-01 16:54:21 -0300 |
---|---|---|
committer | Carlos Galdino <carloshsgaldino@gmail.com> | 2012-07-18 10:32:17 -0300 |
commit | fb8a830a329b78a5863c1dbfb70a4005d3de60ec (patch) | |
tree | f884067efeb47391844fa75118505410dee568f5 /actionpack/test/template | |
parent | c08f30ff5fcda7e07cd9275a073acb2091e4b3f7 (diff) | |
download | rails-fb8a830a329b78a5863c1dbfb70a4005d3de60ec.tar.gz rails-fb8a830a329b78a5863c1dbfb70a4005d3de60ec.tar.bz2 rails-fb8a830a329b78a5863c1dbfb70a4005d3de60ec.zip |
Remove `:confirm` in favor of `:data => { :confirm => 'Text' }` option
This applies to the following helpers:
`button_to`
`button_tag`
`image_submit_tag`
`link_to`
`submit_tag`
Diffstat (limited to 'actionpack/test/template')
-rw-r--r-- | actionpack/test/template/form_tag_helper_test.rb | 11 | ||||
-rw-r--r-- | actionpack/test/template/url_helper_test.rb | 14 |
2 files changed, 16 insertions, 9 deletions
diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 5d19e3274d..05baaa5a85 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -382,7 +382,7 @@ class FormTagHelperTest < ActionView::TestCase def test_submit_tag_with_confirmation assert_dom_equal( %(<input name='commit' type='submit' value='Save' data-confirm="Are you sure?" />), - submit_tag("Save", :confirm => "Are you sure?") + submit_tag("Save", :data => { :confirm => "Are you sure?" }) ) end @@ -437,10 +437,17 @@ class FormTagHelperTest < ActionView::TestCase assert_dom_equal('<button name="temptation" type="button"><strong>Do not press me</strong></button>', output) end + def test_button_tag_with_confirmation + assert_dom_equal( + %(<button name="button" type="submit" data-confirm="Are you sure?">Save</button>), + button_tag("Save", :type => "submit", :data => { :confirm => "Are you sure?" }) + ) + end + def test_image_submit_tag_with_confirmation assert_dom_equal( %(<input type="image" src="/images/save.gif" data-confirm="Are you sure?" />), - image_submit_tag("save.gif", :confirm => "Are you sure?") + image_submit_tag("save.gif", :data => { :confirm => "Are you sure?" }) ) end diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 62608a727f..a09409635d 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -90,7 +90,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_button_to_with_javascript_confirm assert_dom_equal( "<form method=\"post\" action=\"http://www.example.com\" class=\"button_to\"><div><input data-confirm=\"Are you sure?\" type=\"submit\" value=\"Hello\" /></div></form>", - button_to("Hello", "http://www.example.com", :confirm => "Are you sure?") + button_to("Hello", "http://www.example.com", :data => { :confirm => "Are you sure?" }) ) end @@ -108,7 +108,7 @@ class UrlHelperTest < ActiveSupport::TestCase def test_button_to_with_remote_and_javascript_confirm assert_dom_equal( "<form method=\"post\" action=\"http://www.example.com\" class=\"button_to\" data-remote=\"true\"><div><input data-confirm=\"Are you sure?\" type=\"submit\" value=\"Hello\" /></div></form>", - button_to("Hello", "http://www.example.com", :remote => true, :confirm => "Are you sure?") + button_to("Hello", "http://www.example.com", :remote => true, :data => { :confirm => "Are you sure?" }) ) end @@ -208,15 +208,15 @@ class UrlHelperTest < ActiveSupport::TestCase def test_link_tag_with_javascript_confirm assert_dom_equal( "<a href=\"http://www.example.com\" data-confirm=\"Are you sure?\">Hello</a>", - link_to("Hello", "http://www.example.com", :confirm => "Are you sure?") + link_to("Hello", "http://www.example.com", :data => { :confirm => "Are you sure?" }) ) assert_dom_equal( "<a href=\"http://www.example.com\" data-confirm=\"You can't possibly be sure, can you?\">Hello</a>", - link_to("Hello", "http://www.example.com", :confirm => "You can't possibly be sure, can you?") + link_to("Hello", "http://www.example.com", :data => { :confirm => "You can't possibly be sure, can you?" }) ) assert_dom_equal( "<a href=\"http://www.example.com\" data-confirm=\"You can't possibly be sure,\n can you?\">Hello</a>", - link_to("Hello", "http://www.example.com", :confirm => "You can't possibly be sure,\n can you?") + link_to("Hello", "http://www.example.com", :data => { :confirm => "You can't possibly be sure,\n can you?" }) ) end @@ -265,14 +265,14 @@ class UrlHelperTest < ActiveSupport::TestCase def test_link_tag_using_post_javascript_and_confirm assert_dom_equal( "<a href=\"http://www.example.com\" data-method=\"post\" rel=\"nofollow\" data-confirm=\"Are you serious?\">Hello</a>", - link_to("Hello", "http://www.example.com", :method => :post, :confirm => "Are you serious?") + link_to("Hello", "http://www.example.com", :method => :post, :data => { :confirm => "Are you serious?" }) ) end def test_link_tag_using_delete_javascript_and_href_and_confirm assert_dom_equal( "<a href='\#' rel=\"nofollow\" data-confirm=\"Are you serious?\" data-method=\"delete\">Destroy</a>", - link_to("Destroy", "http://www.example.com", :method => :delete, :href => '#', :confirm => "Are you serious?"), + link_to("Destroy", "http://www.example.com", :method => :delete, :href => '#', :data => { :confirm => "Are you serious?" }), "When specifying url, form should be generated with it, but not this.href" ) end |