From 3fe9d8ac359cc38698b3ee7fb876308dfdf144ed Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sat, 26 Mar 2005 14:03:55 +0000 Subject: Added JavascriptHelper#escape_javascript as a public method (was private) and made it escape both single and double quotes and new lines #940 [mortonda@dgrmm.net] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1002 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/test/template/javascript_helper.rb | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 actionpack/test/template/javascript_helper.rb (limited to 'actionpack/test/template') diff --git a/actionpack/test/template/javascript_helper.rb b/actionpack/test/template/javascript_helper.rb new file mode 100644 index 0000000000..39f02e90bf --- /dev/null +++ b/actionpack/test/template/javascript_helper.rb @@ -0,0 +1,9 @@ +require File.dirname(__FILE__) + '/../abstract_unit' + +class JavascriptHelperTest < Test::Unit::TestCase + include ActionView::Helpers::JavascriptHelper + + def test_escape_javascript + assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos')) + end +end -- cgit v1.2.3