diff options
author | lain <lain@soykaf.club> | 2019-05-01 18:40:41 +0200 |
---|---|---|
committer | lain <lain@soykaf.club> | 2019-05-01 18:40:41 +0200 |
commit | 45f790becc2cc63ac000c6432fe8c84e0b589822 (patch) | |
tree | 724d0e8ce5f10807cc25efc2434454bf38c5a52c /test/web/common_api/common_api_utils_test.exs | |
parent | 4908e0eeee2ecb58b204198c20720d52548b6f4a (diff) | |
parent | d107919b3d8b2275ddb7b17846cab182682098a7 (diff) | |
download | pleroma-45f790becc2cc63ac000c6432fe8c84e0b589822.tar.gz |
Merge remote-tracking branch 'origin/develop' into conversations_three
Diffstat (limited to 'test/web/common_api/common_api_utils_test.exs')
-rw-r--r-- | test/web/common_api/common_api_utils_test.exs | 35 |
1 files changed, 30 insertions, 5 deletions
diff --git a/test/web/common_api/common_api_utils_test.exs b/test/web/common_api/common_api_utils_test.exs index f0c59d5c3..ab4c62b35 100644 --- a/test/web/common_api/common_api_utils_test.exs +++ b/test/web/common_api/common_api_utils_test.exs @@ -37,21 +37,21 @@ defmodule Pleroma.Web.CommonAPI.UtilsTest do end test "parses emoji from name and bio" do - {:ok, user} = UserBuilder.insert(%{name: ":karjalanpiirakka:", bio: ":perkele:"}) + {:ok, user} = UserBuilder.insert(%{name: ":blank:", bio: ":firefox:"}) expected = [ %{ "type" => "Emoji", - "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}/finmoji/128px/perkele-128.png"}, - "name" => ":perkele:" + "icon" => %{"type" => "Image", "url" => "#{Endpoint.url()}/emoji/Firefox.gif"}, + "name" => ":firefox:" }, %{ "type" => "Emoji", "icon" => %{ "type" => "Image", - "url" => "#{Endpoint.url()}/finmoji/128px/karjalanpiirakka-128.png" + "url" => "#{Endpoint.url()}/emoji/blank.png" }, - "name" => ":karjalanpiirakka:" + "name" => ":blank:" } ] @@ -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"}) |