diff options
author | lain <lain@soykaf.club> | 2020-07-21 22:18:17 +0000 |
---|---|---|
committer | lain <lain@soykaf.club> | 2020-07-21 22:18:17 +0000 |
commit | 5b1eeb06d81872696fac89dba457fe62b62d6182 (patch) | |
tree | 3082a53ce7d092bf8e4e9a3dfafa8ad5f701f7fc /test | |
parent | c36113cdf5865cbccbd1da2f7404454134139e43 (diff) | |
download | pleroma-5b1eeb06d81872696fac89dba457fe62b62d6182.tar.gz |
Revert "Merge branch 'revert-2b5d9eb1' into 'develop'"
This reverts merge request !2784
Diffstat (limited to 'test')
-rw-r--r-- | test/formatter_test.exs | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/formatter_test.exs b/test/formatter_test.exs index bef5a2c28..8713ab9c2 100644 --- a/test/formatter_test.exs +++ b/test/formatter_test.exs @@ -255,6 +255,36 @@ defmodule Pleroma.FormatterTest do assert {_text, ^expected_mentions, []} = Formatter.linkify(text) end + + test "it parses URL containing local mention" do + _user = insert(:user, %{nickname: "lain"}) + + text = "https://example.com/@lain" + + expected = ~S(<a href="https://example.com/@lain" rel="ugc">https://example.com/@lain</a>) + + assert {^expected, [], []} = Formatter.linkify(text) + end + + test "it correctly parses angry face D:< with mention" do + lain = + insert(:user, %{ + nickname: "lain@lain.com", + ap_id: "https://lain.com/users/lain", + id: "9qrWmR0cKniB0YU0TA" + }) + + text = "@lain@lain.com D:<" + + expected_text = + ~S(<span class="h-card"><a class="u-url mention" data-user="9qrWmR0cKniB0YU0TA" href="https://lain.com/users/lain" rel="ugc">@<span>lain</span></a></span> D:<) + + expected_mentions = [ + {"@lain@lain.com", lain} + ] + + assert {^expected_text, ^expected_mentions, []} = Formatter.linkify(text) + end end describe ".parse_tags" do |