diff --git a/spec/blueprint/html/helpers_spec.cr b/spec/blueprint/html/helpers_spec.cr index afde4d4..dd090ca 100644 --- a/spec/blueprint/html/helpers_spec.cr +++ b/spec/blueprint/html/helpers_spec.cr @@ -1,44 +1,14 @@ require "../../spec_helper" -private class ExamplePage - include Blueprint::HTML - - private def blueprint - div("Tokens", class: ["a", "b", tokens(c?: "c", d?: "d", e?: "e")]) - - div(onclick: safe("")) { safe("") } - - span safe("") - end - - private def c? - true - end - - private def d? - false - end - - private def e? - true - end -end - describe "helpers" do - describe "#tokens" do - it "returns conditional classes" do - page = ExamplePage.new - expected_html = normalize_html <<-HTML -
Tokens
- HTML - - page.to_s.should contain expected_html - end - end - describe "#safe" do it "returns an object that Blueprint will understand as safe to render without escaping" do - page = ExamplePage.new + actual_html = Blueprint::HTML.build do + div(onclick: safe("")) { safe("") } + + span safe("") + end + expected_html = normalize_html <<-HTML
@@ -49,7 +19,7 @@ describe "helpers" do HTML - page.to_s.should contain expected_html + actual_html.should eq expected_html end end diff --git a/src/blueprint/html/helpers.cr b/src/blueprint/html/helpers.cr index 16d8508..48e8acd 100644 --- a/src/blueprint/html/helpers.cr +++ b/src/blueprint/html/helpers.cr @@ -14,16 +14,4 @@ module Blueprint::HTML::Helpers private def escape_once(value) : SafeValue escape_once(value.to_s) end - - @[Experimental] - macro tokens(**conditions) - String.build do |io| - {% for key, value in conditions %} - if {{key.id}} - io << " " unless io.empty? - io << {{value}} - end - {% end %} - end - end end