X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=vendor%2Frails%2Factionpack%2Ftest%2Ftemplate%2Frecord_tag_helper_test.rb;fp=vendor%2Frails%2Factionpack%2Ftest%2Ftemplate%2Frecord_tag_helper_test.rb;h=67aa04774558462532de38fe4b25064937a593c4;hb=437aa336c44c74a30aeea16a06743c32747ed661;hp=0000000000000000000000000000000000000000;hpb=97a0772b06264134cfe38e7494f9427efe0840a0;p=feedcatcher.git diff --git a/vendor/rails/actionpack/test/template/record_tag_helper_test.rb b/vendor/rails/actionpack/test/template/record_tag_helper_test.rb new file mode 100644 index 0000000..67aa047 --- /dev/null +++ b/vendor/rails/actionpack/test/template/record_tag_helper_test.rb @@ -0,0 +1,58 @@ +require 'abstract_unit' + +class Post + def id + 45 + end + def body + "What a wonderful world!" + end +end + +class RecordTagHelperTest < ActionView::TestCase + tests ActionView::Helpers::RecordTagHelper + + def setup + @post = Post.new + end + + def test_content_tag_for + expected = %(
  • ) + actual = content_tag_for(:li, @post, :class => 'bar') { } + assert_dom_equal expected, actual + end + + def test_content_tag_for_prefix + expected = %() + actual = content_tag_for(:ul, @post, :archived) { } + assert_dom_equal expected, actual + end + + def test_content_tag_for_with_extra_html_tags + expected = %() + actual = content_tag_for(:tr, @post, {:class => "bar", :style => "background-color: #f0f0f0"}) { } + assert_dom_equal expected, actual + end + + def test_block_not_in_erb_multiple_calls + expected = %(
    #{@post.body}
    ) + actual = div_for(@post, :class => "bar") { @post.body } + assert_dom_equal expected, actual + actual = div_for(@post, :class => "bar") { @post.body } + assert_dom_equal expected, actual + end + + def test_block_works_with_content_tag_for_in_erb + __in_erb_template = '' + expected = %(#{@post.body}) + actual = content_tag_for(:tr, @post) { concat @post.body } + assert_dom_equal expected, actual + end + + def test_div_for_in_erb + __in_erb_template = '' + expected = %(
    #{@post.body}
    ) + actual = div_for(@post, :class => "bar") { concat @post.body } + assert_dom_equal expected, actual + end +end