From 21141e777bdce8534e3755c8de7268324b3d8714 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Galdino=20+=20Rafael=20Mendon=C3=A7a=20Fran=C3=A7?= =?UTF-8?q?a?= Date: Mon, 14 May 2012 16:22:53 -0300 Subject: Deprecate `:disable_with` in favor of `'data-disable-with'` option for `button_to` and `submit_tag` helpers. --- actionpack/test/template/form_tag_helper_test.rb | 30 +++++++++++++--------- actionpack/test/template/url_helper_test.rb | 32 ++++++++++++++---------- 2 files changed, 37 insertions(+), 25 deletions(-) (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index dcc6dd0411..1bfe2856dc 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -367,17 +367,21 @@ class FormTagHelperTest < ActionView::TestCase end def test_submit_tag - assert_dom_equal( - %(), - submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')") - ) + assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + assert_dom_equal( + %(), + submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')") + ) + end end def test_submit_tag_with_no_onclick_options - assert_dom_equal( - %(), - submit_tag("Save", :disable_with => "Saving...") - ) + assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + assert_dom_equal( + %(), + submit_tag("Save", :disable_with => "Saving...") + ) + end end def test_submit_tag_with_confirmation @@ -388,10 +392,12 @@ class FormTagHelperTest < ActionView::TestCase end def test_submit_tag_with_confirmation_and_with_disable_with - assert_dom_equal( - %(), - submit_tag("Save", :disable_with => "Saving...", :confirm => "Are you sure?") - ) + assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + assert_dom_equal( + %(), + submit_tag("Save", :disable_with => "Saving...", :confirm => "Are you sure?") + ) + end end def test_button_tag diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index 734b6f3aef..b7f4a1c139 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -82,16 +82,18 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_button_to_with_javascript_disable_with - assert_dom_equal( - "
", - button_to("Hello", "http://www.example.com", :disable_with => "Greeting...") - ) + assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + assert_dom_equal( + "
", + button_to("Hello", "http://www.example.com", :disable_with => "Greeting...") + ) + end end def test_button_to_with_remote_and_form_options assert_dom_equal "
", button_to("Hello", "http://www.example.com", :remote => true, :form => { :class => "custom-class", "data-type" => "json" } ) end - + def test_button_to_with_remote_and_javascript_confirm assert_dom_equal( "
", @@ -100,17 +102,21 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_button_to_with_remote_and_javascript_disable_with - assert_dom_equal( - "
", - button_to("Hello", "http://www.example.com", :remote => true, :disable_with => "Greeting...") - ) + assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + assert_dom_equal( + "
", + button_to("Hello", "http://www.example.com", :remote => true, :disable_with => "Greeting...") + ) + end end def test_button_to_with_remote_and_javascript_confirm_and_javascript_disable_with - assert_dom_equal( - "
", - button_to("Hello", "http://www.example.com", :remote => true, :confirm => "Are you sure?", :disable_with => "Greeting...") - ) + assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + assert_dom_equal( + "
", + button_to("Hello", "http://www.example.com", :remote => true, :confirm => "Are you sure?", :disable_with => "Greeting...") + ) + end end def test_button_to_with_remote_false -- cgit v1.2.3