From e9051e20aeb2c666db06b6217954737665878db7 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:55:13 -0300 Subject: Deprecate `:disable_with` for `button_tag` too --- actionpack/CHANGELOG.md | 2 +- actionpack/lib/action_view/helpers/form_tag_helper.rb | 4 +++- actionpack/lib/action_view/helpers/url_helper.rb | 2 +- actionpack/test/template/form_tag_helper_test.rb | 15 ++++++++++++--- actionpack/test/template/url_helper_test.rb | 6 +++--- 5 files changed, 20 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md index 2a6e80fc89..0e778eb01d 100644 --- a/actionpack/CHANGELOG.md +++ b/actionpack/CHANGELOG.md @@ -1,6 +1,6 @@ ## Rails 3.2.4 (unreleased) ## -* Deprecate `:disable_with` in favor of `'data-disable-with'` option for `button_to` and `submit_tag` helpers. +* Deprecate `:disable_with` in favor of `'data-disable-with'` option for `button_to`, `button_tag` and `submit_tag` helpers. *Carlos Galdino + Rafael Mendonça França* diff --git a/actionpack/lib/action_view/helpers/form_tag_helper.rb b/actionpack/lib/action_view/helpers/form_tag_helper.rb index 8ccffb4952..3d3ae44eb4 100644 --- a/actionpack/lib/action_view/helpers/form_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/form_tag_helper.rb @@ -417,7 +417,7 @@ module ActionView options = options.stringify_keys if disable_with = options.delete("disable_with") - ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" + ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.0. Use 'data-disable-with' instead" options["data-disable-with"] = disable_with end @@ -469,6 +469,8 @@ module ActionView options = options.stringify_keys if disable_with = options.delete("disable_with") + ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.0. Use 'data-disable-with' instead" + options["data-disable-with"] = disable_with end diff --git a/actionpack/lib/action_view/helpers/url_helper.rb b/actionpack/lib/action_view/helpers/url_helper.rb index 804b204fd1..6f05881d08 100644 --- a/actionpack/lib/action_view/helpers/url_helper.rb +++ b/actionpack/lib/action_view/helpers/url_helper.rb @@ -623,7 +623,7 @@ module ActionView method = html_options.delete('method') if disable_with - ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" + ActiveSupport::Deprecation.warn ":disable_with option is deprecated and will be removed from Rails 4.0. Use 'data-disable-with' instead" html_options["data-disable-with"] = disable_with end diff --git a/actionpack/test/template/form_tag_helper_test.rb b/actionpack/test/template/form_tag_helper_test.rb index 1bfe2856dc..d9f91e952b 100644 --- a/actionpack/test/template/form_tag_helper_test.rb +++ b/actionpack/test/template/form_tag_helper_test.rb @@ -367,7 +367,7 @@ class FormTagHelperTest < ActionView::TestCase end def test_submit_tag - assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + 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!')") @@ -376,7 +376,7 @@ class FormTagHelperTest < ActionView::TestCase end def test_submit_tag_with_no_onclick_options - assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + 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...") @@ -392,7 +392,7 @@ class FormTagHelperTest < ActionView::TestCase end def test_submit_tag_with_confirmation_and_with_disable_with - assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + 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?") @@ -421,6 +421,15 @@ class FormTagHelperTest < ActionView::TestCase ) end + def test_button_tag_with_disable_with + 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_tag("Save", :type => "submit", :disable_with => "Saving...") + ) + end + end + def test_button_tag_with_reset_type assert_dom_equal( %(), diff --git a/actionpack/test/template/url_helper_test.rb b/actionpack/test/template/url_helper_test.rb index b7f4a1c139..3a7cf9d8a3 100644 --- a/actionpack/test/template/url_helper_test.rb +++ b/actionpack/test/template/url_helper_test.rb @@ -82,7 +82,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_button_to_with_javascript_disable_with - assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + 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...") @@ -102,7 +102,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_button_to_with_remote_and_javascript_disable_with - assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + 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...") @@ -111,7 +111,7 @@ class UrlHelperTest < ActiveSupport::TestCase end def test_button_to_with_remote_and_javascript_confirm_and_javascript_disable_with - assert_deprecated ":disable_with option is deprecated and will be removed from Rails 4.0. Use :data-disable-with instead" do + 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...") -- cgit v1.2.3