summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfeld <feld@feld.me>2024-09-06 15:52:06 +0000
committerfeld <feld@feld.me>2024-09-06 15:52:06 +0000
commit7f3600fddd7209a19409ff296b50822e06ab42cb (patch)
tree1c6e1088891fe8c4f85bd9d7052e1f72b1ca06ad
parent2c916ccd89ee6d0f4dbf05d39374f0c27237d5d7 (diff)
parent1afcfd4845fb71e111b7cbcf18858bb100863f8a (diff)
downloadpleroma-7f3600fddd7209a19409ff296b50822e06ab42cb.tar.gz
pleroma-7f3600fddd7209a19409ff296b50822e06ab42cb.zip
Merge branch 'scrubber-mention-hashtag' into 'develop'
Add tests for Mastodon mention hashtag class See merge request pleroma/pleroma!4255
-rw-r--r--test/pleroma/html_test.exs22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/pleroma/html_test.exs b/test/pleroma/html_test.exs
index 1be161971..d17b07540 100644
--- a/test/pleroma/html_test.exs
+++ b/test/pleroma/html_test.exs
@@ -41,6 +41,10 @@ defmodule Pleroma.HTMLTest do
<span class="h-card"><a class="u-url mention animate-spin">@<span>foo</span></a></span>
"""
+ @mention_hashtags_sample """
+ <a href="https://mastodon.example/tags/linux" class="mention hashtag" rel="tag">#<span>linux</span></a>
+ """
+
describe "StripTags scrubber" do
test "works as expected" do
expected = """
@@ -126,6 +130,15 @@ defmodule Pleroma.HTMLTest do
Pleroma.HTML.Scrubber.TwitterText
)
end
+
+ test "does allow mention hashtags" do
+ expected = """
+ <a href="https://mastodon.example/tags/linux" class="mention hashtag" rel="tag">#<span>linux</span></a>
+ """
+
+ assert expected ==
+ HTML.filter_tags(@mention_hashtags_sample, Pleroma.HTML.Scrubber.Default)
+ end
end
describe "default scrubber" do
@@ -189,6 +202,15 @@ defmodule Pleroma.HTMLTest do
Pleroma.HTML.Scrubber.Default
)
end
+
+ test "does allow mention hashtags" do
+ expected = """
+ <a href="https://mastodon.example/tags/linux" class="mention hashtag" rel="tag">#<span>linux</span></a>
+ """
+
+ assert expected ==
+ HTML.filter_tags(@mention_hashtags_sample, Pleroma.HTML.Scrubber.Default)
+ end
end
describe "extract_first_external_url_from_object" do