summaryrefslogtreecommitdiff
path: root/test/web/common_api/common_api_utils_test.exs
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-05-07 16:51:11 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-05-07 16:51:11 +0700
commit1557b99beb3b406572ef2d3baaabed1c9baeca1c (patch)
tree34041b8526ecfa38fcb0b471718de0b3b71aa8c4 /test/web/common_api/common_api_utils_test.exs
parentc157e27a000a12dc8f660c056744a6611beb01b1 (diff)
parent6518644db1d31f2b30b95fa0899b3751bc330d56 (diff)
downloadpleroma-1557b99beb3b406572ef2d3baaabed1c9baeca1c.tar.gz
pleroma-1557b99beb3b406572ef2d3baaabed1c9baeca1c.zip
Merge remote-tracking branch 'pleroma/develop' into feature/disable-account
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"})