Skip to content
Browse files

Merge pull request #441 from Casecommons/stable

Fix signature of InstanceTag#content_tag.
  • Loading branch information...
2 parents 84450bb + c500c16 commit 135f291c0e65527851fc1dc9ae6dbeaeb6268a1a @nex3 nex3 committed
Showing with 19 additions and 3 deletions.
  1. +4 −3 lib/haml/helpers/action_view_mods.rb
  2. +15 −0 test/haml/template_test.rb
View
7 lib/haml/helpers/action_view_mods.rb
@@ -130,7 +130,8 @@ def content_tag_with_haml(name, *args, &block)
end
class InstanceTag
- # Includes TagHelper
+ # Already includes TagHelper
+ include Haml::Helpers
def haml_buffer
@template_object.send :haml_buffer
@@ -140,8 +141,8 @@ def is_haml?
@template_object.send :is_haml?
end
- def content_tag(*args)
- html_tag = content_tag_with_haml(*args)
+ def content_tag(*args, &block)
+ html_tag = content_tag_with_haml(*args, &block)
return html_tag unless respond_to?(:error_wrapping)
return error_wrapping(html_tag) if method(:error_wrapping).arity == 1
return html_tag unless object.respond_to?(:errors) && object.errors.respond_to?(:on)
View
15 test/haml/template_test.rb
@@ -297,6 +297,21 @@ def test_av_block_deprecation_warning
end
end
+ if defined?(ActionView::Helpers::InstanceTag)
+ def test_form_builder_label_with_block
+ assert_equal(<<HTML, render(<<HAML, :action_view))
+<form #{rails_form_attr}action="" method="post">#{rails_form_opener}
+ <label for="article_title">Block content
+ </label>
+</form>
+HTML
+#{rails_block_helper_char} form_for #{form_for_calling_convention(:article)}, :url => '' do |f|
+ = f.label :title do
+ Block content
+HAML
+ end
+ end
+
## XSS Protection Tests
# In order to enable these, either test against Rails 3.0

0 comments on commit 135f291

Please sign in to comment.
Something went wrong with that request. Please try again.