smarter mention parsing #2466

This commit is contained in:
r888888888
2015-11-02 12:30:37 -08:00
parent f8cea30602
commit 286c71b342
2 changed files with 27 additions and 13 deletions

View File

@@ -5,6 +5,13 @@ class DTextTest < ActiveSupport::TestCase
DText.parse(s)
end
def test_mentions
assert_equal('<p><a href="/users?name=bob">@bob</a></p>', p("@bob"))
assert_equal('<p>hi <a href="/users?name=bob">@bob</a></p>', p("hi @bob"))
assert_equal('<p>this is not @.@ @_@ <a href="/users?name=bob">@bob</a></p>', p("this is not @.@ @_@ @bob"))
assert_equal('<p>multiple <a href="/users?name=bob">@bob</a> <a href="/users?name=anna">@anna</a></p>', p("multiple @bob @anna"))
end
def test_sanitize_heart
assert_equal('<p>&lt;3</p>', p("<3"))
end