diff --git a/spec/instance_template/attributes_spec.cr b/spec/instance_template/attributes_spec.cr index 4c045b9..a1584ca 100644 --- a/spec/instance_template/attributes_spec.cr +++ b/spec/instance_template/attributes_spec.cr @@ -21,10 +21,13 @@ module ToHtml::InstanceTemplate::AttributesSpec "Options" end select_tag id: SomeId.to_s, name: "myselect" do + option(value: "", selected: false) { "-" } ["one", "two", "three"].each do |val| option(value: val, selected: val == DEFAULT_VALUE) { val } end end + input name: "name", type: "text", required: true + input name: "surname", type: "text", required: false end end @@ -86,10 +89,13 @@ module ToHtml::InstanceTemplate::AttributesSpec
HTML diff --git a/src/instance_template.cr b/src/instance_template.cr index 5b7104e..3412a2f 100644 --- a/src/instance_template.cr +++ b/src/instance_template.cr @@ -149,7 +149,7 @@ module ToHtml {% if call.named_args %} {% for named_arg in call.named_args %} - %attr_hash[{{named_arg.name.stringify}}] = {{named_arg.value}}.to_s + %attr_hash[{{named_arg.name.stringify}}] = {{named_arg.value}} {% end %} {% end %} @@ -210,7 +210,7 @@ module ToHtml {% if call.named_args %} {% for named_arg in call.named_args %} - %attr_hash[{{named_arg.name.stringify}}] = {{named_arg.value}}.to_s + %attr_hash[{{named_arg.name.stringify}}] = {{named_arg.value}} {% end %} {% end %}