diff --git a/test/integration/test_ad_hoc.rb b/test/integration/test_ad_hoc.rb index 356e8d1..eb96ff2 100644 --- a/test/integration/test_ad_hoc.rb +++ b/test/integration/test_ad_hoc.rb @@ -315,5 +315,49 @@ def test_dont_remove_whitespace_between_tags assert_equal(expected, actual.to_html) end + + describe "entities" do + it "handles & character" do + input = %{
this & that
} + expected = %{
this & that
} + actual = Loofah.scrub_fragment(input, :escape) + assert_equal(expected, actual.to_html) + end + + it "handles > character" do + input = %{
this > that
} + expected = %{
this > that
} + actual = Loofah.scrub_fragment(input, :escape) + assert_equal(expected, actual.to_html) + end + + it "handles < character" do + input = %{
this < that
} + expected = %{
this < that
} + actual = Loofah.scrub_fragment(input, :escape) + assert_equal(expected, actual.to_html) + end + + it "handles < character in an attribute" do + input = %{
wave
} + expected = %{
wave
} + actual = Loofah.scrub_fragment(input, :escape) + assert_equal(expected, actual.to_html) + end + + it "handles multiple < characters" do + input = %{
this <<
} + expected = %{
this <<
} + actual = Loofah.scrub_fragment(input, :escape) + assert_equal(expected, actual.to_html) + end + + it "handles < entity" do + input = %{
this < that
} + expected = input + actual = Loofah.scrub_fragment(input, :escape) + assert_equal(expected, actual.to_html) + end + end end end