Permalink
Browse files

Deprecate `:disable_with` for `button_tag` too

  • Loading branch information...
Carlos Galdino + Rafael Mendonça França
Carlos Galdino + Rafael Mendonça França committed May 14, 2012
1 parent d47d6e7 commit e9051e20aeb2c666db06b6217954737665878db7
View
@@ -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*
@@ -417,7 +417,7 @@ def submit_tag(value = "Save changes", options = {})
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 @@ def button_tag(content_or_options = nil, options = nil, &block)
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
@@ -623,7 +623,7 @@ def convert_options_to_data_attributes(options, html_options)
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
@@ -367,7 +367,7 @@ def test_stringify_symbol_keys
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(
%(<input name='commit' data-disable-with="Saving..." onclick="alert('hello!')" type="submit" value="Save" />),
submit_tag("Save", :disable_with => "Saving...", :onclick => "alert('hello!')")
@@ -376,7 +376,7 @@ def test_submit_tag
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(
%(<input name='commit' data-disable-with="Saving..." type="submit" value="Save" />),
submit_tag("Save", :disable_with => "Saving...")
@@ -392,7 +392,7 @@ def test_submit_tag_with_confirmation
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(
%(<input name="commit" data-disable-with="Saving..." data-confirm="Are you sure?" type="submit" value="Save" />),
submit_tag("Save", :disable_with => "Saving...", :confirm => "Are you sure?")
@@ -421,6 +421,15 @@ def test_button_tag_with_button_type
)
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 name="button" data-disable-with="Saving..." type="submit">Save</button>),
+ button_tag("Save", :type => "submit", :disable_with => "Saving...")
+ )
+ end
+ end
+
def test_button_tag_with_reset_type
assert_dom_equal(
%(<button name="button" type="reset">Reset</button>),
@@ -82,7 +82,7 @@ def test_button_to_with_javascript_confirm
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(
"<form method=\"post\" action=\"http://www.example.com\" class=\"button_to\"><div><input data-disable-with=\"Greeting...\" type=\"submit\" value=\"Hello\" /></div></form>",
button_to("Hello", "http://www.example.com", :disable_with => "Greeting...")
@@ -102,7 +102,7 @@ def test_button_to_with_remote_and_javascript_confirm
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(
"<form method=\"post\" action=\"http://www.example.com\" class=\"button_to\" data-remote=\"true\"><div><input data-disable-with=\"Greeting...\" type=\"submit\" value=\"Hello\" /></div></form>",
button_to("Hello", "http://www.example.com", :remote => true, :disable_with => "Greeting...")
@@ -111,7 +111,7 @@ def test_button_to_with_remote_and_javascript_disable_with
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(
"<form method=\"post\" action=\"http://www.example.com\" class=\"button_to\" data-remote=\"true\"><div><input data-disable-with=\"Greeting...\" data-confirm=\"Are you sure?\" type=\"submit\" value=\"Hello\" /></div></form>",
button_to("Hello", "http://www.example.com", :remote => true, :confirm => "Are you sure?", :disable_with => "Greeting...")

0 comments on commit e9051e2

Please sign in to comment.