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, "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 %(