diff --git a/spec/instance_template/attributes_spec.cr b/spec/instance_template/attributes_spec.cr index a1584ca..24f4a9d 100644 --- a/spec/instance_template/attributes_spec.cr +++ b/spec/instance_template/attributes_spec.cr @@ -8,7 +8,7 @@ module ToHtml::InstanceTemplate::AttributesSpec ToHtml.instance_template do div MyCssClass, MyOtherCssClass, {"class", "so-unique"}, more_css_classes do span(SPECIAL_CSS_CLASSES) { "Blah" } - img SPECIAL_CSS_CLASSES, more_css_classes + img SPECIAL_CSS_CLASSES, more_css_classes, {"class", nil} div MyStimulusController do p({"class", "so-special"}) do "Some content" @@ -17,10 +17,10 @@ module ToHtml::InstanceTemplate::AttributesSpec end fieldset do - label for: SomeId.to_s do + label for: SomeId do "Options" end - select_tag id: SomeId.to_s, name: "myselect" do + select_tag id: SomeId, name: "myselect" do option(value: "", selected: false) { "-" } ["one", "two", "three"].each do |val| option(value: val, selected: val == DEFAULT_VALUE) { val } diff --git a/src/attribute_hash.cr b/src/attribute_hash.cr index d279ce7..9a1b288 100644 --- a/src/attribute_hash.cr +++ b/src/attribute_hash.cr @@ -17,9 +17,9 @@ module ToHtml def []=(key, value) if attributes.has_key?(key) - attributes[key] += " #{value}" + attributes[key] += " #{value}" if value else - attributes[key] = value + attributes[key] = value.to_s end end