Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

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)

Makes the failing tests in 1.2 stable back into passing tests for prototype and javascript helpers

  • actionpack/test/template/prototype_helper_test.rb

    old new  
    170170  end 
    171171   
    172172  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");', 
    174174      @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");', 
    176176      @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");', 
    178178      @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");', 
    180180      @generator.insert_html(:after, 'element', '<p>This is a test</p>') 
    181181  end 
    182182   
    183183  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");', 
    185185      @generator.replace_html('element', '<p>This is a test</p>') 
    186186  end 
    187187   
    188188  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");', 
    190190      @generator.replace('element', '<div id="element"><p>This is a test</p></div>') 
    191191  end 
    192192   
     
    241241    @generator.remove('foo', 'bar') 
    242242    @generator.replace_html('baz', '<p>This is a test</p>') 
    243243     
    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"); 
     245new Insertion.Bottom("element", "\074p\076This is a test\074/p\076"); 
    247246["foo", "bar"].each(Element.remove); 
    248 Element.update("baz", "<p>This is a test</p>"); 
    249     EOS 
     247Element.update("baz", "\074p\076This is a test\074/p\076");) 
     248 
     249    assert_equal expected, @generator.to_s 
    250250  end 
    251251 
    252252  def test_element_access 
  • actionpack/test/template/javascript_helper_test.rb

    old new  
    3636    html = link_to_function( "Greet me!" ) do |page| 
    3737      page.replace_html 'header', "<h1>Greetings</h1>" 
    3838    end 
    39     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 
     39    assert_dom_equal %q(<a href="#" onclick="Element.update(&quot;header&quot;, &quot;\074h1\076Greetings\074/h1\076&quot;);; return false;">Greet me!</a>), html 
    4040  end 
    4141 
    4242  def test_link_to_function_with_rjs_block_and_options 
    4343    html = link_to_function( "Greet me!", :class => "updater" ) do |page| 
    4444      page.replace_html 'header', "<h1>Greetings</h1>" 
    4545    end 
    46     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 
     46    assert_dom_equal %q(<a href="#" class="updater" onclick="Element.update(&quot;header&quot;, &quot;\074h1\076Greetings\074/h1\076&quot;);; return false;">Greet me!</a>), html 
    4747  end 
    4848 
    4949  def test_button_to_function 
     
    5555    html = button_to_function( "Greet me!" ) do |page| 
    5656      page.replace_html 'header', "<h1>Greetings</h1>" 
    5757    end 
    58     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 
     58    assert_dom_equal %q(<input type="button" onclick="Element.update(&quot;header&quot;, &quot;\074h1\076Greetings\074/h1\076&quot;);;" value="Greet me!" />), html 
    5959  end 
    6060 
    6161  def test_button_to_function_with_rjs_block_and_options 
    6262    html = button_to_function( "Greet me!", :class => "greeter" ) do |page| 
    6363      page.replace_html 'header', "<h1>Greetings</h1>" 
    6464    end 
    65     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 
     65    assert_dom_equal %q(<input type="button" class="greeter" onclick="Element.update(&quot;header&quot;, &quot;\074h1\076Greetings\074/h1\076&quot;);;" value="Greet me!" />), html 
    6666  end 
    6767end