diff --git a/quickdraw/sgml/attributes.test.rb b/quickdraw/sgml/attributes.test.rb index 169016f3..7c113951 100644 --- a/quickdraw/sgml/attributes.test.rb +++ b/quickdraw/sgml/attributes.test.rb @@ -10,7 +10,7 @@ assert_raises(Phlex::ArgumentError) { phlex { div(:ID => "abc") } } output = phlex { div(id: "abc") } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "*invalid*, _" do @@ -46,7 +46,7 @@ phlex { a("Href" => "javascript:javascript:alert('hello')") }, phlex { a(href: " \t\njavascript:alert('hello')") }, ].each do |output| - assert_equal output, %() + assert_equal_html output, %() end end @@ -92,88 +92,88 @@ test "_, nil" do output = phlex { div(attribute: nil) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, true" do output = phlex { div(attribute: true) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, false" do output = phlex { div(attribute: false) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, String" do with_empty_string = phlex { div(attribute: "") } - assert_equal with_empty_string, %(
) + assert_equal_html with_empty_string, %(
) with_regular_string = phlex { div(attribute: "test") } - assert_equal with_regular_string, %(
) + assert_equal_html with_regular_string, %(
) with_underscores = phlex { div(attribute: "with_underscores") } - assert_equal with_underscores, %(
) + assert_equal_html with_underscores, %(
) with_dashes = phlex { div(attribute: "with-dashes") } - assert_equal with_dashes, %(
) + assert_equal_html with_dashes, %(
) with_spaces = phlex { div(attribute: "with spaces") } - assert_equal with_spaces, %(
) + assert_equal_html with_spaces, %(
) with_single_quotes = phlex { div(attribute: "with 'single quotes'") } - assert_equal with_single_quotes, %(
) + assert_equal_html with_single_quotes, %(
) with_html = phlex { div(attribute: "with ") } - assert_equal with_html, %(
) + assert_equal_html with_html, %(
) with_double_quotes = phlex { div(attribute: 'with "double quotes"') } - assert_equal with_double_quotes, %(
) + assert_equal_html with_double_quotes, %(
) end test "_, Symbol" do empty_symbol = phlex { div(attribute: :"") } - assert_equal empty_symbol, %(
) + assert_equal_html empty_symbol, %(
) simple_symbol = phlex { div(attribute: :test) } - assert_equal simple_symbol, %(
) + assert_equal_html simple_symbol, %(
) symbol_with_underscores = phlex { div(attribute: :with_underscores) } - assert_equal symbol_with_underscores, %(
) + assert_equal_html symbol_with_underscores, %(
) symbol_with_dashes = phlex { div(attribute: :"with-dashes") } - assert_equal symbol_with_dashes, %(
) + assert_equal_html symbol_with_dashes, %(
) symbol_with_spaces = phlex { div(attribute: :"with spaces") } - assert_equal symbol_with_spaces, %(
) + assert_equal_html symbol_with_spaces, %(
) symbol_with_single_quotes = phlex { div(attribute: :"with 'single quotes'") } - assert_equal symbol_with_single_quotes, %(
) + assert_equal_html symbol_with_single_quotes, %(
) symbol_with_html = phlex { div(attribute: :"with ") } - assert_equal symbol_with_html, %(
) + assert_equal_html symbol_with_html, %(
) symbol_with_double_quotes = phlex { div(attribute: :'with "double quotes"') } - assert_equal symbol_with_double_quotes, %(
) + assert_equal_html symbol_with_double_quotes, %(
) end test "_, Integer" do output = phlex { div(attribute: 0) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: 42) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Float" do output = phlex { div(attribute: 0.0) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: 42.0) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: 1.234) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, *invalid*" do @@ -184,64 +184,64 @@ test "_, Array" do output = phlex { div(attribute: []) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(nil)" do output = phlex { div(attribute: [nil, nil, nil]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(String)" do output = phlex { div(attribute: ["Hello", "World"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: ["with_underscores", "with-dashes", "with spaces"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: ["with 'single quotes'", 'with "double quotes"']) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(Symbol)" do output = phlex { div(attribute: [:hello, :world]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: [:with_underscores, :"with-dashes", :"with spaces"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: [:with, :"'single quotes'", :'"double quotes"']) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(Integer)" do output = phlex { div(attribute: [0, 42]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(Float)" do output = phlex { div(attribute: [0.0, 42.0, 1.234]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(Phlex::SGML::SafeObject)" do output = phlex { div(attribute: [Phlex::SGML::SafeValue.new("Hello")]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(String | Array)" do output = phlex { div(attribute: ["hello", ["world"]]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(Array | String)" do output = phlex { div(attribute: [["hello"], "world"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(String | EmptyArray)" do output = phlex { div(attribute: ["hello", []]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Array(*invalid*)" do @@ -252,7 +252,7 @@ test "_, Hash(Symbol, _)" do output = phlex { div(attribute: { a_b_c: "world" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :'"' => "a" }) } } assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { :"'" => "a" }) } } @@ -263,7 +263,7 @@ test "_, Hash(String, _)" do output = phlex { div(attribute: { "a_b_c" => "world" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { '"' => "a" }) } } assert_raises(Phlex::ArgumentError) { phlex { div(attribute: { "'" => "a" }) } } @@ -278,94 +278,94 @@ test "_, Hash(_, String)" do with_underscores = phlex { div(data: { controller: "with_underscores" }) } - assert_equal with_underscores, %(
) + assert_equal_html with_underscores, %(
) with_dashes = phlex { div(data: { controller: "with-dashes" }) } - assert_equal with_dashes, %(
) + assert_equal_html with_dashes, %(
) with_spaces = phlex { div(data: { controller: "with spaces" }) } - assert_equal with_spaces, %(
) + assert_equal_html with_spaces, %(
) with_single_quotes = phlex { div(data: { controller: "with 'single quotes'" }) } - assert_equal with_single_quotes, %(
) + assert_equal_html with_single_quotes, %(
) with_html = phlex { div(data: { controller: "with " }) } - assert_equal with_html, %(
) + assert_equal_html with_html, %(
) with_double_quotes = phlex { div(data: { controller: 'with "double quotes"' }) } - assert_equal with_double_quotes, %(
) + assert_equal_html with_double_quotes, %(
) end test "_, Hash(_, Symbol)" do output = phlex { div(data: { controller: :with_underscores }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: :"with-dashes" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: :"with spaces" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: :"with 'single quotes'" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: :"with " }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: :'with "double quotes"' }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, Integer)" do output = phlex { div(data: { controller: 42 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: 1_234 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: 0 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, Float)" do output = phlex { div(data: { controller: 42.0 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: 1.234 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(data: { controller: 0.0 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, Array)" do output = phlex { div(data: { controller: [1, 2, 3] }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, Set)" do output = phlex { div(data: { controller: Set[1, 2, 3] }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, Hash)" do output = phlex { div(data: { controller: { hello: "world" } }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, Phlex::SGML::SafeObject)" do output = phlex { div(data: { controller: Phlex::SGML::SafeValue.new("Hello") }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, false)" do output = phlex { div(data: { controller: false }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, nil)" do output = phlex { div(data: { controller: nil }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Hash(_, *invalid*)" do @@ -376,39 +376,39 @@ test "_, Set(nil)" do output = phlex { div(attribute: Set[nil, nil, nil]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Set(String)" do output = phlex { div(attribute: Set["Hello", "World"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: Set["with_underscores", "with-dashes", "with spaces"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: Set["with 'single quotes'", 'with "double quotes"']) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Set(Symbol)" do output = phlex { div(attribute: Set[:hello, :world]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: Set[:with_underscores, :"with-dashes", :"with spaces"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(attribute: Set[:with, :"single quotes", :'"double quotes"']) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Set(Integer)" do output = phlex { div(attribute: Set[0, 42]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Set(Float)" do output = phlex { div(attribute: Set[0.0, 42.0, 1.234]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Set(Phlex::SGML::SafeObject)" do @@ -416,7 +416,7 @@ div(attribute: Set[Phlex::SGML::SafeValue.new("Hello")]) end - assert_equal output, %(
) + assert_equal_html output, %(
) end test "_, Set(*invalid*)" do @@ -427,7 +427,7 @@ test ":style, Array(nil)" do output = phlex { div(style: [nil, nil, nil]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Array(Symbol)" do @@ -438,69 +438,69 @@ test ":style, Array(String)" do output = phlex { div(style: ["color: blue;", "font-weight: bold"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(style: ["font-family: 'MonoLisa'"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(style: ['font-family: "MonoLisa"']) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Array(Phlex::SGML::SafeObject)" do output = phlex { div(style: [Phlex::SGML::SafeValue.new("color: blue")]) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(style: [Phlex::SGML::SafeValue.new("font-weight: bold;")]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Array(Hash)" do output = phlex { div(style: [{ color: "blue" }, { font_weight: "bold", line_height: 1.5 }]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Set(nil)" do output = phlex { div(style: Set[nil]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Set(String)" do output = phlex { div(style: Set["color: blue"]) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, String)" do output = phlex { div(style: { color: "blue", font_weight: "bold" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, Integer)" do output = phlex { div(style: { line_height: 2 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, Float)" do output = phlex { div(style: { line_height: 1.5 }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, Symbol)" do output = phlex { div(style: { flex_direction: :column_reverse }) } - assert_equal output, %(
) + assert_equal_html output, %(
) output = phlex { div(style: { flex_direction: :'"double quotes"' }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, Phlex::SGML::SafeObject)" do output = phlex { div(style: { color: Phlex::SGML::SafeValue.new("blue") }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, nil)" do output = phlex { div(style: { color: nil }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(Symbol, *invalid*)" do @@ -511,7 +511,7 @@ test ":style, Hash(String, String)" do output = phlex { div(style: { "color" => "blue" }) } - assert_equal output, %(
) + assert_equal_html output, %(
) end test ":style, Hash(*invalid*, String)" do diff --git a/quickdraw/sgml/callbacks.test.rb b/quickdraw/sgml/callbacks.test.rb index 18efb6b1..d3d53ad2 100644 --- a/quickdraw/sgml/callbacks.test.rb +++ b/quickdraw/sgml/callbacks.test.rb @@ -27,5 +27,5 @@ def view_template end test "callbacks are called in the correct order" do - assert_equal Example.call, "1234567" + assert_equal_html Example.call, "1234567" end diff --git a/quickdraw/sgml/capture.test.rb b/quickdraw/sgml/capture.test.rb index 1d465d6a..c1bb5eed 100644 --- a/quickdraw/sgml/capture.test.rb +++ b/quickdraw/sgml/capture.test.rb @@ -11,5 +11,5 @@ def view_template(&block) "#{a} #{b} #{c}" end - assert_equal output, "

a b c

" + assert_equal_html output, "

a b c

" end diff --git a/quickdraw/sgml/comment.test.rb b/quickdraw/sgml/comment.test.rb index 9c898b66..9af66220 100644 --- a/quickdraw/sgml/comment.test.rb +++ b/quickdraw/sgml/comment.test.rb @@ -9,7 +9,7 @@ comment { "Hello World" } end - assert_equal output, "" + assert_equal_html output, "" end test "block comment with markup" do @@ -19,5 +19,5 @@ end end - assert_equal output, "" + assert_equal_html output, "" end diff --git a/quickdraw/sgml/conditional_rendering.test.rb b/quickdraw/sgml/conditional_rendering.test.rb index 3d7c9851..d312120a 100644 --- a/quickdraw/sgml/conditional_rendering.test.rb +++ b/quickdraw/sgml/conditional_rendering.test.rb @@ -13,6 +13,6 @@ def view_template end test do - assert_equal Example.new(render: true).call, "

Hello

" - assert_equal Example.new(render: false).call, "" + assert_equal_html Example.new(render: true).call, "

Hello

" + assert_equal_html Example.new(render: false).call, "" end diff --git a/quickdraw/sgml/content_yielding.test.rb b/quickdraw/sgml/content_yielding.test.rb index 6232c994..62eaea2e 100644 --- a/quickdraw/sgml/content_yielding.test.rb +++ b/quickdraw/sgml/content_yielding.test.rb @@ -11,7 +11,7 @@ def view_template end test "should render the test class" do - assert_equal TestClass.call, %q() + assert_equal_html TestClass.call, %q() end class OtherTestClass < Phlex::HTML @@ -25,5 +25,5 @@ def view_template end test "should render the test class" do - assert_equal OtherTestClass.call, %q(

hi there

) + assert_equal_html OtherTestClass.call, %q(

hi there

) end diff --git a/quickdraw/sgml/plain.test.rb b/quickdraw/sgml/plain.test.rb index d7a015e5..519e92a4 100644 --- a/quickdraw/sgml/plain.test.rb +++ b/quickdraw/sgml/plain.test.rb @@ -6,27 +6,27 @@ test "with string" do output = phlex { plain "Hello, World!" } - assert_equal output, "Hello, World!" + assert_equal_html output, "Hello, World!" end test "with symbol" do output = phlex { plain :hello_world } - assert_equal output, "hello_world" + assert_equal_html output, "hello_world" end test "with integer" do output = phlex { plain 42 } - assert_equal output, "42" + assert_equal_html output, "42" end test "with float" do output = phlex { plain 3.14 } - assert_equal output, "3.14" + assert_equal_html output, "3.14" end test "with nil" do output = phlex { plain nil } - assert_equal output, "" + assert_equal_html output, "" end test "with invalid arguments" do diff --git a/quickdraw/sgml/raw.test.rb b/quickdraw/sgml/raw.test.rb index 62dd095b..28484661 100644 --- a/quickdraw/sgml/raw.test.rb +++ b/quickdraw/sgml/raw.test.rb @@ -14,15 +14,15 @@ test "with a safe object" do output = phlex { raw safe %(
&
) } - assert_equal output, %(
&
) + assert_equal_html output, %(
&
) end test "with nil" do output = phlex { div { raw nil } } - assert_equal output, "
" + assert_equal_html output, "
" end test "with empty string" do output = phlex { div { raw "" } } - assert_equal output, "
" + assert_equal_html output, "
" end diff --git a/quickdraw/sgml/safe.test.rb b/quickdraw/sgml/safe.test.rb index 76c1e000..b4d493d5 100644 --- a/quickdraw/sgml/safe.test.rb +++ b/quickdraw/sgml/safe.test.rb @@ -12,7 +12,7 @@ ) end - assert_equal output, %() + assert_equal_html output, %() end test "element content blocks that return safe values" do @@ -22,7 +22,7 @@ } end - assert_equal output, %() + assert_equal_html output, %() end test "with invalid input" do diff --git a/quickdraw/sgml/selective_rendering.test.rb b/quickdraw/sgml/selective_rendering.test.rb index 9427d8e6..3c517400 100644 --- a/quickdraw/sgml/selective_rendering.test.rb +++ b/quickdraw/sgml/selective_rendering.test.rb @@ -67,17 +67,17 @@ def view_template test "renders the just the target fragment" do output = StandardElementExample.new.call(fragments: ["target"]) - assert_equal output, %(

HelloWorld

) + assert_equal_html output, %(

HelloWorld

) end test "works with void elements" do output = VoidElementExample.new.call(fragments: ["target"]) - assert_equal output, %() + assert_equal_html output, %() end test "supports multiple fragments" do output = StandardElementExample.new.call(fragments: ["target", "image"]) - assert_equal output, %(

HelloWorld

) + assert_equal_html output, %(

HelloWorld

) end test "halts early after all fragments are found" do @@ -90,15 +90,15 @@ def view_template test "with a capture block doesn't render the capture block" do output = WithCaptureBlock.new.call(fragments: ["after"]) - assert_equal output, %(

After

) + assert_equal_html output, %(

After

) end test "with a capture block renders the capture block when selected" do output = WithCaptureBlock.new.call(fragments: ["around"]) - assert_equal output, %(
<h1 id="inside">Inside</h1>
) + assert_equal_html output, %(
<h1 id="inside">Inside</h1>
) end test "with a capture block doesn't select from the capture block" do output = WithCaptureBlock.new.call(fragments: ["inside"]) - assert_equal output, "" + assert_equal_html output, "" end diff --git a/quickdraw/sgml/to_proc.test.rb b/quickdraw/sgml/to_proc.test.rb index 2b185518..44bcfe11 100644 --- a/quickdraw/sgml/to_proc.test.rb +++ b/quickdraw/sgml/to_proc.test.rb @@ -26,5 +26,5 @@ def view_template end end - assert_equal output, %(

Sub

) + assert_equal_html output, %(

Sub

) end diff --git a/quickdraw/sgml/whitespace.test.rb b/quickdraw/sgml/whitespace.test.rb index f7a8dee5..8bcbe3c6 100644 --- a/quickdraw/sgml/whitespace.test.rb +++ b/quickdraw/sgml/whitespace.test.rb @@ -11,7 +11,7 @@ div end - assert_equal output, %(
) + assert_equal_html output, %(
) end test "whitespae around" do @@ -21,5 +21,5 @@ div end - assert_equal output, %(
) + assert_equal_html output, %(
) end diff --git "a/quickdraw/\360\237\222\252.test.rb" "b/quickdraw/\360\237\222\252.test.rb" index 4a932c40..a4a93e7e 100644 --- "a/quickdraw/\360\237\222\252.test.rb" +++ "b/quickdraw/\360\237\222\252.test.rb" @@ -7,5 +7,5 @@ def view_template end test "💪" do - assert_equal Example.new.call, %(

💪

) + assert_equal_html Example.new.call, %(

💪

) end