aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/template/java_script_macros_helper_test.rb
diff options
context:
space:
mode:
authorSam Stephenson <sam@37signals.com>2005-10-12 22:47:39 +0000
committerSam Stephenson <sam@37signals.com>2005-10-12 22:47:39 +0000
commitf49dc37e7100d8358d864a6e008c17acd24765fc (patch)
tree10b737ba4c573cdec74362f427e605d72996f166 /actionpack/test/template/java_script_macros_helper_test.rb
parentb840e4ed509da433895fd2becf13f3e5656708e4 (diff)
downloadrails-f49dc37e7100d8358d864a6e008c17acd24765fc.tar.gz
rails-f49dc37e7100d8358d864a6e008c17acd24765fc.tar.bz2
rails-f49dc37e7100d8358d864a6e008c17acd24765fc.zip
Wrap javascript_tag contents in a CDATA section and add a cdata_section method to TagHelper. Closes #1691.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2543 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/test/template/java_script_macros_helper_test.rb')
-rw-r--r--actionpack/test/template/java_script_macros_helper_test.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/actionpack/test/template/java_script_macros_helper_test.rb b/actionpack/test/template/java_script_macros_helper_test.rb
index 5f96d06861..1e882dba04 100644
--- a/actionpack/test/template/java_script_macros_helper_test.rb
+++ b/actionpack/test/template/java_script_macros_helper_test.rb
@@ -23,15 +23,15 @@ class JavaScriptMacrosHelperTest < Test::Unit::TestCase
def test_auto_complete_field
- assert_dom_equal %(<script type=\"text/javascript\">new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {})</script>),
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" });
- assert_dom_equal %(<script type=\"text/javascript\">new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:','})</script>),
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:','})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => ',');
- assert_dom_equal %(<script type=\"text/javascript\">new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:[',']})</script>),
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {tokens:[',']})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :tokens => [',']);
- assert_dom_equal %(<script type=\"text/javascript\">new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {min_chars:3})</script>),
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {min_chars:3})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :min_chars => 3);
- assert_dom_equal %(<script type=\"text/javascript\">new Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {onHide:function(element, update){Alert('me');}})</script>),
+ assert_dom_equal %(<script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.Autocompleter('some_input', 'some_input_auto_complete', 'http://www.example.com/autocomplete', {onHide:function(element, update){Alert('me');}})\n//]]>\n</script>),
auto_complete_field("some_input", :url => { :action => "autocomplete" }, :on_hide => "function(element, update){Alert('me');}");
end
@@ -50,7 +50,7 @@ class JavaScriptMacrosHelperTest < Test::Unit::TestCase
def test_text_field_with_auto_complete
assert_match "<style>",
text_field_with_auto_complete(:message, :recipient)
- assert_dom_equal %(<input id=\"message_recipient\" name=\"message[recipient]\" size=\"30\" type=\"text\" /><div class=\"auto_complete\" id=\"message_recipient_auto_complete\"></div><script type=\"text/javascript\">new Ajax.Autocompleter('message_recipient', 'message_recipient_auto_complete', 'http://www.example.com/auto_complete_for_message_recipient', {})</script>),
+ assert_dom_equal %(<input id=\"message_recipient\" name=\"message[recipient]\" size=\"30\" type=\"text\" /><div class=\"auto_complete\" id=\"message_recipient_auto_complete\"></div><script type=\"text/javascript\">\n//<![CDATA[\nnew Ajax.Autocompleter('message_recipient', 'message_recipient_auto_complete', 'http://www.example.com/auto_complete_for_message_recipient', {})\n//]]>\n</script>),
text_field_with_auto_complete(:message, :recipient, {}, :skip_style => true)
end
end