X-Git-Url: http://git.squeep.com/?a=blobdiff_plain;ds=sidebyside;f=test%2Fhtml_test.exs;h=08738276eb02e28d70cd99b527da89ddbf5fc30f;hb=fc7246d7159a97a8b9bb878e848db6f8ac0df988;hp=0b5d3d89265fd6ee1bd3efc4e3df0219db80f027;hpb=2a96283efbd46c017cf9e15ef4fda3188e5e5bca;p=akkoma
diff --git a/test/html_test.exs b/test/html_test.exs
index 0b5d3d892..08738276e 100644
--- a/test/html_test.exs
+++ b/test/html_test.exs
@@ -20,6 +20,18 @@ defmodule Pleroma.HTMLTest do
"""
+ @html_span_class_sample """
+ hi
+ """
+
+ @html_span_microformats_sample """
+ @foo
+ """
+
+ @html_span_invalid_microformats_sample """
+ @foo
+ """
+
describe "StripTags scrubber" do
test "works as expected" do
expected = """
@@ -64,6 +76,36 @@ defmodule Pleroma.HTMLTest do
assert expected == HTML.filter_tags(@html_onerror_sample, Pleroma.HTML.Scrubber.TwitterText)
end
+
+ test "does not allow spans with invalid classes" do
+ expected = """
+ hi
+ """
+
+ assert expected ==
+ HTML.filter_tags(@html_span_class_sample, Pleroma.HTML.Scrubber.TwitterText)
+ end
+
+ test "does allow microformats" do
+ expected = """
+ @foo
+ """
+
+ assert expected ==
+ HTML.filter_tags(@html_span_microformats_sample, Pleroma.HTML.Scrubber.TwitterText)
+ end
+
+ test "filters invalid microformats markup" do
+ expected = """
+ @foo
+ """
+
+ assert expected ==
+ HTML.filter_tags(
+ @html_span_invalid_microformats_sample,
+ Pleroma.HTML.Scrubber.TwitterText
+ )
+ end
end
describe "default scrubber" do
@@ -88,5 +130,34 @@ defmodule Pleroma.HTMLTest do
assert expected == HTML.filter_tags(@html_onerror_sample, Pleroma.HTML.Scrubber.Default)
end
+
+ test "does not allow spans with invalid classes" do
+ expected = """
+ hi
+ """
+
+ assert expected == HTML.filter_tags(@html_span_class_sample, Pleroma.HTML.Scrubber.Default)
+ end
+
+ test "does allow microformats" do
+ expected = """
+ @foo
+ """
+
+ assert expected ==
+ HTML.filter_tags(@html_span_microformats_sample, Pleroma.HTML.Scrubber.Default)
+ end
+
+ test "filters invalid microformats markup" do
+ expected = """
+ @foo
+ """
+
+ assert expected ==
+ HTML.filter_tags(
+ @html_span_invalid_microformats_sample,
+ Pleroma.HTML.Scrubber.Default
+ )
+ end
end
end