diff --git a/spec/blueprint/html/attributes_handling_spec.cr b/spec/blueprint/html/attributes_handling_spec.cr index 6c0e00a..eab94d2 100644 --- a/spec/blueprint/html/attributes_handling_spec.cr +++ b/spec/blueprint/html/attributes_handling_spec.cr @@ -55,6 +55,18 @@ describe "attributes handling" do actual_html.should eq expected_html end + it "doesn't render nil attributes" do + actual_html = Blueprint::HTML.build do + div class: nil, data: {id: nil} + end + + expected_html = normalize_html <<-HTML +
+ HTML + + actual_html.should eq expected_html + end + it "expands NamedTuple attributes" do actual_html = Blueprint::HTML.build do nav aria: {target: "#home", selected: "false", enabled: true, hidden: false} do diff --git a/spec/blueprint/html/custom_elements_registration_spec.cr b/spec/blueprint/html/custom_elements_spec.cr similarity index 67% rename from spec/blueprint/html/custom_elements_registration_spec.cr rename to spec/blueprint/html/custom_elements_spec.cr index 067e884..2fbe53f 100644 --- a/spec/blueprint/html/custom_elements_registration_spec.cr +++ b/spec/blueprint/html/custom_elements_spec.cr @@ -11,8 +11,25 @@ private class Example end end -describe "custom elements registration" do - it "allows custom elements definition" do +describe "custom elements" do + it "allows custom elements rendering" do + actual_html = Blueprint::HTML.build do + element :foo, class: "bar", data: {tmp: true} do + "Hello" + end + + void_element :portal, class: "my-portal" + end + + expected_html = normalize_html <<-HTML +