1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix alias_method, add test

This commit is contained in:
David Heinemeier Hansson 2011-03-27 11:20:54 -07:00
parent a9d27c04ab
commit cc6fa2f4d7
2 changed files with 2 additions and 1 deletions

View file

@ -58,7 +58,7 @@ module ActionView
end end
end end
alias_method :escape_javascript, :j alias_method :j, :escape_javascript
# Returns a JavaScript tag with the +content+ inside. Example: # Returns a JavaScript tag with the +content+ inside. Example:
# javascript_tag "alert('All is good')" # javascript_tag "alert('All is good')"

View file

@ -27,6 +27,7 @@ class JavaScriptHelperTest < ActionView::TestCase
assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos')) assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos'))
assert_equal %(backslash\\\\test), escape_javascript( %(backslash\\test) ) assert_equal %(backslash\\\\test), escape_javascript( %(backslash\\test) )
assert_equal %(dont <\\/close> tags), escape_javascript(%(dont </close> tags)) assert_equal %(dont <\\/close> tags), escape_javascript(%(dont </close> tags))
assert_equal %(dont <\\/close> tags), j(%(dont </close> tags))
end end
def test_button_to_function def test_button_to_function