Ticket #9821: stable-fixes_to_encoding_tests_in_prototype_and_javascript_helpers.diff
| File stable-fixes_to_encoding_tests_in_prototype_and_javascript_helpers.diff, 4.9 kB (added by mikel, 1 year ago) |
|---|
-
actionpack/test/template/prototype_helper_test.rb
old new 170 170 end 171 171 172 172 def test_insert_html_with_string 173 assert_equal 'new Insertion.Top("element", " <p>This is a test</p>");',173 assert_equal 'new Insertion.Top("element", "\074p\076This is a test\074/p\076");', 174 174 @generator.insert_html(:top, 'element', '<p>This is a test</p>') 175 assert_equal 'new Insertion.Bottom("element", " <p>This is a test</p>");',175 assert_equal 'new Insertion.Bottom("element", "\074p\076This is a test\074/p\076");', 176 176 @generator.insert_html(:bottom, 'element', '<p>This is a test</p>') 177 assert_equal 'new Insertion.Before("element", " <p>This is a test</p>");',177 assert_equal 'new Insertion.Before("element", "\074p\076This is a test\074/p\076");', 178 178 @generator.insert_html(:before, 'element', '<p>This is a test</p>') 179 assert_equal 'new Insertion.After("element", " <p>This is a test</p>");',179 assert_equal 'new Insertion.After("element", "\074p\076This is a test\074/p\076");', 180 180 @generator.insert_html(:after, 'element', '<p>This is a test</p>') 181 181 end 182 182 183 183 def test_replace_html_with_string 184 assert_equal 'Element.update("element", " <p>This is a test</p>");',184 assert_equal 'Element.update("element", "\074p\076This is a test\074/p\076");', 185 185 @generator.replace_html('element', '<p>This is a test</p>') 186 186 end 187 187 188 188 def test_replace_element_with_string 189 assert_equal 'Element.replace("element", " <div id=\"element\"><p>This is a test</p></div>");',189 assert_equal 'Element.replace("element", "\074div id=\"element\"\076\074p\076This is a test\074/p\076\074/div\076");', 190 190 @generator.replace('element', '<div id="element"><p>This is a test</p></div>') 191 191 end 192 192 … … 241 241 @generator.remove('foo', 'bar') 242 242 @generator.replace_html('baz', '<p>This is a test</p>') 243 243 244 assert_equal <<-EOS.chomp, @generator.to_s 245 new Insertion.Top("element", "<p>This is a test</p>"); 246 new Insertion.Bottom("element", "<p>This is a test</p>"); 244 expected = %q(new Insertion.Top("element", "\074p\076This is a test\074/p\076"); 245 new Insertion.Bottom("element", "\074p\076This is a test\074/p\076"); 247 246 ["foo", "bar"].each(Element.remove); 248 Element.update("baz", "<p>This is a test</p>"); 249 EOS 247 Element.update("baz", "\074p\076This is a test\074/p\076");) 248 249 assert_equal expected, @generator.to_s 250 250 end 251 251 252 252 def test_element_access -
actionpack/test/template/javascript_helper_test.rb
old new 36 36 html = link_to_function( "Greet me!" ) do |page| 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 %q(<a href="#" onclick="Element.update("header", "\074h1\076Greetings\074/h1\076");; return false;">Greet me!</a>), html 40 40 end 41 41 42 42 def test_link_to_function_with_rjs_block_and_options 43 43 html = link_to_function( "Greet me!", :class => "updater" ) do |page| 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 %q(<a href="#" class="updater" onclick="Element.update("header", "\074h1\076Greetings\074/h1\076");; return false;">Greet me!</a>), html 47 47 end 48 48 49 49 def test_button_to_function … … 55 55 html = button_to_function( "Greet me!" ) do |page| 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 %q(<input type="button" onclick="Element.update("header", "\074h1\076Greetings\074/h1\076");;" value="Greet me!" />), html 59 59 end 60 60 61 61 def test_button_to_function_with_rjs_block_and_options 62 62 html = button_to_function( "Greet me!", :class => "greeter" ) do |page| 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 %q(<input type="button" class="greeter" onclick="Element.update("header", "\074h1\076Greetings\074/h1\076");;" value="Greet me!" />), html 66 66 end 67 67 end