Merge pull request #637 from haml/attribute-methods

Attribute methods
This commit is contained in:
Norman Clarke 2013-02-26 14:29:26 -08:00
commit c0b1d236a8
2 changed files with 6 additions and 1 deletions

View File

@ -195,7 +195,7 @@ END
elsif attributes_hashes.size == 1
attributes_hashes = ", #{attributes_hashes.first}"
else
attributes_hashes = ", (#{attributes_hashes.join(").merge(")})"
attributes_hashes = ", #{attributes_hashes.join(", ")}"
end
push_merged_text "<#{t[:name]}", 0, !t[:nuke_outer_whitespace]

View File

@ -214,6 +214,11 @@ HAML
render(".no_attributes{:nil => nil}").chomp)
end
def test_attribute_method_with_both_attrib_styles_and_non_static_hashes
assert_equal("<div baz='qux' foo='bar' zig='zag'></div>",
render("%div{{:foo => 'bar'}, :baz => 'qux'}(zig = val)", :locals => {:val => 'zag'}).chomp)
end
def test_strings_should_get_stripped_inside_tags
assert_equal("<div class='stripped'>This should have no spaces in front of it</div>",
render(".stripped This should have no spaces in front of it").chomp)