Skip to content

Commit 38fafe6

Browse files
committed
#29 double tag with attributes passed through class shortcut will not render corectly
1 parent ab46db6 commit 38fafe6

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/hammer_builder/abstract/abstract_double_tag.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ def method_missing(method, *args, &block)
1919
self.rclass.add_attributes Data::Attribute.new(method.to_sym, :string)
2020
self.send method, *args, &block
2121
else
22-
self.__send__($3 == '!' ? :id : :class, $2.gsub(@_str_underscore, @_str_dash), &block)
2322
attributes(if args.last.is_a?(Hash)
2423
args.pop
2524
end)
2625
content args.first
26+
self.__send__($3 == '!' ? :id : :class, $2.gsub(@_str_underscore, @_str_dash), &block)
2727
end
2828
else
2929
super(method, *args, &block)

spec/hammer_builder_spec.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ def quick_render &block
133133
quick_render { div.id 'an', 'id', nil, false }.should == '<div id="an-id"></div>'
134134

135135
quick_render { div.an_id! :class => 'big' }.should == '<div id="an-id" class="big"></div>'
136+
quick_render { div.an_id!(:class => 'big') { text 'content' } }.should ==
137+
'<div id="an-id" class="big">content</div>'
136138
quick_render { div.an_id! 'content', :class => 'big' }.should == '<div id="an-id" class="big">content</div>'
137139
quick_render { div.an_id! 'content' }.should == '<div id="an-id">content</div>'
138140
quick_render { hr.an_id! :class => 'big' }.should == '<hr id="an-id" class="big" />'

0 commit comments

Comments
 (0)