diff options
author | kaniini <nenolod@gmail.com> | 2019-04-27 07:44:24 +0000 |
---|---|---|
committer | kaniini <nenolod@gmail.com> | 2019-04-27 07:44:24 +0000 |
commit | 002ea343f8c6dc9669bce91942f835a2c7cc6ae7 (patch) | |
tree | 2886d3742bdec921839bfca4e4b76b60925c3ed0 /test | |
parent | 81bc274930ea4e78224a475da03847caa94ecbea (diff) | |
parent | ef52aa0e6647d00f5ff984d655ef4b27ab3e6b1a (diff) | |
download | pleroma-002ea343f8c6dc9669bce91942f835a2c7cc6ae7.tar.gz |
Merge branch 'feature/bbcode' into 'develop'
BBCode support (backend)
See merge request pleroma/pleroma!1097
Diffstat (limited to 'test')
-rw-r--r-- | test/web/common_api/common_api_utils_test.exs | 25 |
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<strong>second paragraph!</strong>" + + {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"}) |