aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2007-05-29 09:42:13 +0000
committerRick Olson <technoweenie@gmail.com>2007-05-29 09:42:13 +0000
commit32b307bc32e12626b0e6ae493cc3ab34b4c5ea37 (patch)
treec77df7c4eb0cd04b12cb919b11459262d4502a56 /actionpack
parent0345c975879e352a5726ff9f91258fdb3afe8525 (diff)
downloadrails-32b307bc32e12626b0e6ae493cc3ab34b4c5ea37.tar.gz
rails-32b307bc32e12626b0e6ae493cc3ab34b4c5ea37.tar.bz2
rails-32b307bc32e12626b0e6ae493cc3ab34b4c5ea37.zip
fix test cases to match new json output. Closes #8371
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6894 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/action_controller/assertions/selector_assertions.rb2
-rw-r--r--actionpack/test/template/javascript_helper_test.rb8
-rw-r--r--actionpack/test/template/prototype_helper_test.rb18
3 files changed, 15 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/assertions/selector_assertions.rb b/actionpack/lib/action_controller/assertions/selector_assertions.rb
index 8bb3402668..05ca2bff15 100644
--- a/actionpack/lib/action_controller/assertions/selector_assertions.rb
+++ b/actionpack/lib/action_controller/assertions/selector_assertions.rb
@@ -586,6 +586,8 @@ module ActionController
# RJS encodes double quotes and line breaks.
unescaped= rjs_string.gsub('\"', '"')
unescaped.gsub!('\n', "\n")
+ unescaped.gsub!('\076', '>')
+ unescaped.gsub!('\074', '<')
# RJS encodes non-ascii characters.
unescaped.gsub!(RJS_PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')}
unescaped
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb
index a2454a03e4..7ffc381df5 100644
--- a/actionpack/test/template/javascript_helper_test.rb
+++ b/actionpack/test/template/javascript_helper_test.rb
@@ -36,14 +36,14 @@ class JavaScriptHelperTest < Test::Unit::TestCase
html = link_to_function( "Greet me!" ) do |page|
page.replace_html 'header', "<h1>Greetings</h1>"
end
- assert_dom_equal %(<a href="#" onclick="Element.update(&quot;header&quot;, &quot;&lt;h1&gt;Greetings&lt;/h1&gt;&quot;);; return false;">Greet me!</a>), html
+ assert_dom_equal %(<a href="#" onclick="Element.update(&quot;header&quot;, &quot;\\074h1\\076Greetings\\074/h1\\076&quot;);; return false;">Greet me!</a>), html
end
def test_link_to_function_with_rjs_block_and_options
html = link_to_function( "Greet me!", :class => "updater" ) do |page|
page.replace_html 'header', "<h1>Greetings</h1>"
end
- assert_dom_equal %(<a href="#" class="updater" onclick="Element.update(&quot;header&quot;, &quot;&lt;h1&gt;Greetings&lt;/h1&gt;&quot;);; return false;">Greet me!</a>), html
+ assert_dom_equal %(<a href="#" class="updater" onclick="Element.update(&quot;header&quot;, &quot;\\074h1\\076Greetings\\074/h1\\076&quot;);; return false;">Greet me!</a>), html
end
def test_button_to_function
@@ -55,13 +55,13 @@ class JavaScriptHelperTest < Test::Unit::TestCase
html = button_to_function( "Greet me!" ) do |page|
page.replace_html 'header', "<h1>Greetings</h1>"
end
- assert_dom_equal %(<input type="button" onclick="Element.update(&quot;header&quot;, &quot;&lt;h1&gt;Greetings&lt;/h1&gt;&quot;);;" value="Greet me!" />), html
+ assert_dom_equal %(<input type="button" onclick="Element.update(&quot;header&quot;, &quot;\\074h1\\076Greetings\\074/h1\\076&quot;);;" value="Greet me!" />), html
end
def test_button_to_function_with_rjs_block_and_options
html = button_to_function( "Greet me!", :class => "greeter" ) do |page|
page.replace_html 'header', "<h1>Greetings</h1>"
end
- assert_dom_equal %(<input type="button" class="greeter" onclick="Element.update(&quot;header&quot;, &quot;&lt;h1&gt;Greetings&lt;/h1&gt;&quot;);;" value="Greet me!" />), html
+ assert_dom_equal %(<input type="button" class="greeter" onclick="Element.update(&quot;header&quot;, &quot;\\074h1\\076Greetings\\074/h1\\076&quot;);;" value="Greet me!" />), html
end
end
diff --git a/actionpack/test/template/prototype_helper_test.rb b/actionpack/test/template/prototype_helper_test.rb
index a94802fdfb..033e75de78 100644
--- a/actionpack/test/template/prototype_helper_test.rb
+++ b/actionpack/test/template/prototype_helper_test.rb
@@ -232,23 +232,23 @@ class JavaScriptGeneratorTest < Test::Unit::TestCase
end
def test_insert_html_with_string
- assert_equal 'new Insertion.Top("element", "<p>This is a test</p>");',
+ assert_equal 'new Insertion.Top("element", "\\074p\\076This is a test\\074/p\\076");',
@generator.insert_html(:top, 'element', '<p>This is a test</p>')
- assert_equal 'new Insertion.Bottom("element", "<p>This is a test</p>");',
+ assert_equal 'new Insertion.Bottom("element", "\\074p\076This is a test\\074/p\076");',
@generator.insert_html(:bottom, 'element', '<p>This is a test</p>')
- assert_equal 'new Insertion.Before("element", "<p>This is a test</p>");',
+ assert_equal 'new Insertion.Before("element", "\\074p\076This is a test\\074/p\076");',
@generator.insert_html(:before, 'element', '<p>This is a test</p>')
- assert_equal 'new Insertion.After("element", "<p>This is a test</p>");',
+ assert_equal 'new Insertion.After("element", "\\074p\076This is a test\\074/p\076");',
@generator.insert_html(:after, 'element', '<p>This is a test</p>')
end
def test_replace_html_with_string
- assert_equal 'Element.update("element", "<p>This is a test</p>");',
+ assert_equal 'Element.update("element", "\\074p\\076This is a test\\074/p\\076");',
@generator.replace_html('element', '<p>This is a test</p>')
end
def test_replace_element_with_string
- assert_equal 'Element.replace("element", "<div id=\"element\"><p>This is a test</p></div>");',
+ assert_equal 'Element.replace("element", "\\074div id=\"element\"\\076\\074p\\076This is a test\\074/p\\076\\074/div\\076");',
@generator.replace('element', '<div id="element"><p>This is a test</p></div>')
end
@@ -304,10 +304,10 @@ class JavaScriptGeneratorTest < Test::Unit::TestCase
@generator.replace_html('baz', '<p>This is a test</p>')
assert_equal <<-EOS.chomp, @generator.to_s
-new Insertion.Top("element", "<p>This is a test</p>");
-new Insertion.Bottom("element", "<p>This is a test</p>");
+new Insertion.Top("element", "\\074p\\076This is a test\\074/p\\076");
+new Insertion.Bottom("element", "\\074p\\076This is a test\\074/p\\076");
["foo", "bar"].each(Element.remove);
-Element.update("baz", "<p>This is a test</p>");
+Element.update("baz", "\\074p\\076This is a test\\074/p\\076");
EOS
end