summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_utils_test.exs
diff options
context:
space:
mode:
authorSachin Joshi <satchin.joshi@gmail.com>2019-05-01 00:21:30 +0545
committerSachin Joshi <satchin.joshi@gmail.com>2019-05-01 00:21:30 +0545
commitcd6da3606b0170b1a5c7d64b96f1621896cc0930 (patch)
tree76086dd4145017de644bdeb17a389bb4d8c7a298 /test/web/common_api/common_api_utils_test.exs
parent963d5774af7efb57fa306b3ac164049f8958a72c (diff)
parent77690b9d03facf74483e3379f72b5b51c9f1bd4e (diff)
downloadpleroma-cd6da3606b0170b1a5c7d64b96f1621896cc0930.tar.gz
pleroma-cd6da3606b0170b1a5c7d64b96f1621896cc0930.zip
Merge branch 'develop' into bugfix/web-notification-special-char
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r--test/web/common_api/common_api_utils_test.exs25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs
index 837a66063..ab4c62b35 100644
--- a/test/web/common_api/common_api_utils_test.exs
+++ b/test/web/common_api/common_api_utils_test.exs
@@ -119,6 +119,31 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do
assert output == expected
end
+ test "works for bare text/bbcode" do
+ text = "[b]hello world[/b]"
+ expected = "<strong>hello world</strong>"
+
+ {output, [], []} = Utils.format_input(text, "text/bbcode")
+
+ assert output == expected
+
+ text = "[b]hello world![/b]\n\nsecond paragraph!"
+ expected = "<strong>hello world!</strong><br>\n<br>\nsecond paragraph!"
+
+ {output, [], []} = Utils.format_input(text, "text/bbcode")
+
+ assert output == expected
+
+ text = "[b]hello world![/b]\n\n<strong>second paragraph!</strong>"
+
+ expected =
+ "<strong>hello world!</strong><br>\n<br>\n&lt;strong&gt;second paragraph!&lt;/strong&gt;"
+
+ {output, [], []} = Utils.format_input(text, "text/bbcode")
+
+ assert output == expected
+ end
+
test "works for text/markdown with mentions" do
{:ok, user} =
UserBuilder.insert(%{nickname: "user__test", ap_id: "http://foo.com/user__test"})