aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMark Felder <feld@feld.me>2021-06-11 15:35:38 -0500
committerMark Felder <feld@feld.me>2021-06-11 15:35:38 -0500
commit07064f73bcf9091774a72650a5cc9cb973810bd2 (patch)
tree6a3d7a64562992b96afbf816f516686018dc6306 /test
parentbaf7fd2142a28ff2219c6be8906861490a9f0753 (diff)
downloadpleroma-07064f73bcf9091774a72650a5cc9cb973810bd2.tar.gz
Do not rely on cached stripped content. We need the control to preserve the breaks.
Diffstat (limited to 'test')
-rw-r--r--test/pleroma/web/metadata/utils_test.exs19
1 files changed, 18 insertions, 1 deletions
diff --git a/test/pleroma/web/metadata/utils_test.exs b/test/pleroma/web/metadata/utils_test.exs
index b5d3e3566..c5d241886 100644
--- a/test/pleroma/web/metadata/utils_test.exs
+++ b/test/pleroma/web/metadata/utils_test.exs
@@ -23,6 +23,22 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
assert Utils.scrub_html_and_truncate(note) == "Pleroma's really cool!"
end
+ test "it replaces <br> with compatible HTML entity (objects)" do
+ user = insert(:user)
+
+ note =
+ insert(:note, %{
+ data: %{
+ "actor" => user.ap_id,
+ "id" => "https://pleroma.gov/objects/whatever",
+ "content" => "First line<br>Second line"
+ }
+ })
+
+ assert Utils.scrub_html_and_truncate(note) ==
+ "First line&#10;&#13;Second line"
+ end
+
test "it returns text without encode HTML (binaries)" do
assert Utils.scrub_html_and_truncate("Pleroma's really cool!") == "Pleroma's really cool!"
end
@@ -44,7 +60,8 @@ defmodule Pleroma.Web.Metadata.UtilsTest do
end
test "it strips HTML tags and other entities (binaries)" do
- assert Utils.scrub_html_and_truncate("<title>my title</title> <p>and a paragraph&#33;</p>") == "my title and a paragraph!"
+ assert Utils.scrub_html_and_truncate("<title>my title</title> <p>and a paragraph&#33;</p>") ==
+ "my title and a paragraph!"
end
end
end