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

Ticket #7432: tag_helper_allowing_content_tag_in_helpers.diff

File tag_helper_allowing_content_tag_in_helpers.diff, 1.4 kB (added by biocs_nerd, 2 years ago)

Patch described by biocs_nerd

  • actionpack/test/template/tag_helper_test.rb

    old new  
    4747    assert_dom_equal %(<div class="green">Hello world!</div>), _erbout 
    4848  end 
    4949   
     50  def test_content_tag_with_block_and_nil_erbout 
     51    content_tag(:div) { "Hello world!" } 
     52    assert_dom_equal %(<div>Hello world!</div>), "<div>Hello world!</div>" 
     53  end 
     54   
     55  def test_content_tag_with_block_nil_erbout_and_options 
     56    content_tag(:div, :class => "green") { "Hello world!" } 
     57    assert_dom_equal %(<div class="green">Hello world!</div>), "<div class=\"green\">Hello world!</div>" 
     58  end 
     59   
    5060  def test_cdata_section 
    5161    assert_equal "<![CDATA[<hello world>]]>", cdata_section("<hello world>") 
    5262  end 
  • actionpack/lib/action_view/helpers/tag_helper.rb

    old new  
    5353          content = content_or_options_with_block 
    5454          content_tag_string(name, content, options) 
    5555        end 
     56      rescue NameError 
     57        content_tag_string(name, content, options) 
    5658      end 
    5759 
    5860      # Returns a CDATA section with the given +content+.  CDATA sections