Changeset 6894
- Timestamp:
- 05/29/07 09:42:13 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/lib/action_controller/assertions/selector_assertions.rb
r6861 r6894 587 587 unescaped= rjs_string.gsub('\"', '"') 588 588 unescaped.gsub!('\n', "\n") 589 unescaped.gsub!('\076', '>') 590 unescaped.gsub!('\074', '<') 589 591 # RJS encodes non-ascii characters. 590 592 unescaped.gsub!(RJS_PATTERN_UNICODE_ESCAPED_CHAR) {|u| [$1.hex].pack('U*')} trunk/actionpack/test/template/javascript_helper_test.rb
r6057 r6894 37 37 page.replace_html 'header', "<h1>Greetings</h1>" 38 38 end 39 assert_dom_equal %(<a href="#" onclick="Element.update("header", " <h1>Greetings</h1>");; return false;">Greet me!</a>), html39 assert_dom_equal %(<a href="#" onclick="Element.update("header", "\\074h1\\076Greetings\\074/h1\\076");; return false;">Greet me!</a>), html 40 40 end 41 41 … … 44 44 page.replace_html 'header', "<h1>Greetings</h1>" 45 45 end 46 assert_dom_equal %(<a href="#" class="updater" onclick="Element.update("header", " <h1>Greetings</h1>");; return false;">Greet me!</a>), html46 assert_dom_equal %(<a href="#" class="updater" onclick="Element.update("header", "\\074h1\\076Greetings\\074/h1\\076");; return false;">Greet me!</a>), html 47 47 end 48 48 … … 56 56 page.replace_html 'header', "<h1>Greetings</h1>" 57 57 end 58 assert_dom_equal %(<input type="button" onclick="Element.update("header", " <h1>Greetings</h1>");;" value="Greet me!" />), html58 assert_dom_equal %(<input type="button" onclick="Element.update("header", "\\074h1\\076Greetings\\074/h1\\076");;" value="Greet me!" />), html 59 59 end 60 60 … … 63 63 page.replace_html 'header', "<h1>Greetings</h1>" 64 64 end 65 assert_dom_equal %(<input type="button" class="greeter" onclick="Element.update("header", " <h1>Greetings</h1>");;" value="Greet me!" />), html65 assert_dom_equal %(<input type="button" class="greeter" onclick="Element.update("header", "\\074h1\\076Greetings\\074/h1\\076");;" value="Greet me!" />), html 66 66 end 67 67 end trunk/actionpack/test/template/prototype_helper_test.rb
r6775 r6894 233 233 234 234 def test_insert_html_with_string 235 assert_equal 'new Insertion.Top("element", " <p>This is a test</p>");',235 assert_equal 'new Insertion.Top("element", "\\074p\\076This is a test\\074/p\\076");', 236 236 @generator.insert_html(:top, 'element', '<p>This is a test</p>') 237 assert_equal 'new Insertion.Bottom("element", " <p>This is a test</p>");',237 assert_equal 'new Insertion.Bottom("element", "\\074p\076This is a test\\074/p\076");', 238 238 @generator.insert_html(:bottom, 'element', '<p>This is a test</p>') 239 assert_equal 'new Insertion.Before("element", " <p>This is a test</p>");',239 assert_equal 'new Insertion.Before("element", "\\074p\076This is a test\\074/p\076");', 240 240 @generator.insert_html(:before, 'element', '<p>This is a test</p>') 241 assert_equal 'new Insertion.After("element", " <p>This is a test</p>");',241 assert_equal 'new Insertion.After("element", "\\074p\076This is a test\\074/p\076");', 242 242 @generator.insert_html(:after, 'element', '<p>This is a test</p>') 243 243 end 244 244 245 245 def test_replace_html_with_string 246 assert_equal 'Element.update("element", " <p>This is a test</p>");',246 assert_equal 'Element.update("element", "\\074p\\076This is a test\\074/p\\076");', 247 247 @generator.replace_html('element', '<p>This is a test</p>') 248 248 end 249 249 250 250 def test_replace_element_with_string 251 assert_equal 'Element.replace("element", " <div id=\"element\"><p>This is a test</p></div>");',251 assert_equal 'Element.replace("element", "\\074div id=\"element\"\\076\\074p\\076This is a test\\074/p\\076\\074/div\\076");', 252 252 @generator.replace('element', '<div id="element"><p>This is a test</p></div>') 253 253 end … … 305 305 306 306 assert_equal <<-EOS.chomp, @generator.to_s 307 new Insertion.Top("element", " <p>This is a test</p>");308 new Insertion.Bottom("element", " <p>This is a test</p>");307 new Insertion.Top("element", "\\074p\\076This is a test\\074/p\\076"); 308 new Insertion.Bottom("element", "\\074p\\076This is a test\\074/p\\076"); 309 309 ["foo", "bar"].each(Element.remove); 310 Element.update("baz", " <p>This is a test</p>");310 Element.update("baz", "\\074p\\076This is a test\\074/p\\076"); 311 311 EOS 312 312 end