Permalink
Browse files

Deprecate define_javascript_functions in favour of javascript_include…

…_tag
  • Loading branch information...
1 parent 6303ba0 commit a78750f16d19bf988958b92fb0cdf9e575790b94 @NZKoz NZKoz committed Jun 30, 2008
View
@@ -1,5 +1,7 @@
*2.1.1 (next release)*
+* Deprecate define_javascript_functions, javascript_include_tag and friends are much better [Michael Koziarski]
+
* Fix polymorphic_url with singleton resources. #461 [Tammer Saleh]
* Deprecate ActionView::Base.erb_variable. Use the concat helper method instead of appending to it directly. [Jeremy Kemper]
@@ -147,6 +147,8 @@ def define_javascript_functions
javascript << '</script>'
end
+ deprecate :define_javascript_functions=>"use javascript_include_tag instead"
+
# Escape carrier returns and single and double quotes for JavaScript segments.
def escape_javascript(javascript)
(javascript || '').gsub('\\','\0\0').gsub('</','<\/').gsub(/\r\n|\n|\r/, "\\n").gsub(/["']/) { |m| "\\#{m}" }
@@ -4,11 +4,14 @@ class JavaScriptHelperTest < ActionView::TestCase
tests ActionView::Helpers::JavaScriptHelper
def test_define_javascript_functions
- # check if prototype.js is included first
- assert_not_nil define_javascript_functions.split("\n")[1].match(/Prototype JavaScript framework/)
+ assert_deprecated(/javascript_include_tag/) do
+ # check if prototype.js is included first
+ src = define_javascript_functions
+ assert_not_nil src.split("\n")[1].match(/Prototype JavaScript framework/)
- # check that scriptaculous.js is not in here, only needed if loaded remotely
- assert_nil define_javascript_functions.split("\n")[1].match(/var Scriptaculous = \{/)
+ # check that scriptaculous.js is not in here, only needed if loaded remotely
+ assert_nil src.split("\n")[1].match(/var Scriptaculous = \{/)
+ end
end
def test_escape_javascript

0 comments on commit a78750f

Please sign in to comment.