diff options
author | 2023-05-09 12:16:10 +0200 | |
---|---|---|
committer | 2023-05-09 11:16:10 +0100 | |
commit | 0e29f1f5bb68a48d9b837d7f4e0a16370734955b (patch) | |
tree | f08d203ec8ca8aeea728e5251b1dc3956524b4f4 /internal/text/plain_test.go | |
parent | [chore/performance] Make sender multiplier configurable (#1750) (diff) | |
download | gotosocial-0e29f1f5bb68a48d9b837d7f4e0a16370734955b.tar.xz |
[feature] Enable federation in/out of profile PropertyValue fields (#1722)
Co-authored-by: kim <grufwub@gmail.com>
Co-authored-by: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
Diffstat (limited to 'internal/text/plain_test.go')
-rw-r--r-- | internal/text/plain_test.go | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/internal/text/plain_test.go b/internal/text/plain_test.go index c00ae70c3..5a2918563 100644 --- a/internal/text/plain_test.go +++ b/internal/text/plain_test.go @@ -25,14 +25,16 @@ import ( ) const ( - simple = "this is a plain and simple status" - simpleExpected = "<p>this is a plain and simple status</p>" - withTag = "here's a simple status that uses hashtag #welcome!" - withTagExpected = "<p>here's a simple status that uses hashtag <a href=\"http://localhost:8080/tags/welcome\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>welcome</span></a>!</p>" - withHTML = "<div>blah this should just be html escaped blah</div>" - withHTMLExpected = "<p><div>blah this should just be html escaped blah</div></p>" - moreComplex = "Another test @foss_satan@fossbros-anonymous.io\n\n#Hashtag\n\nText\n\n:rainbow:" - moreComplexExpected = "<p>Another test <span class=\"h-card\"><a href=\"http://fossbros-anonymous.io/@foss_satan\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>foss_satan</span></a></span><br><br><a href=\"http://localhost:8080/tags/Hashtag\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>Hashtag</span></a><br><br>Text<br><br>:rainbow:</p>" + simple = "this is a plain and simple status" + simpleExpected = "<p>this is a plain and simple status</p>" + simpleExpectedNoParagraph = "this is a plain and simple status" + withTag = "here's a simple status that uses hashtag #welcome!" + withTagExpected = "<p>here's a simple status that uses hashtag <a href=\"http://localhost:8080/tags/welcome\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>welcome</span></a>!</p>" + withTagExpectedNoParagraph = "here's a simple status that uses hashtag <a href=\"http://localhost:8080/tags/welcome\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>welcome</span></a>!" + withHTML = "<div>blah this should just be html escaped blah</div>" + withHTMLExpected = "<p><div>blah this should just be html escaped blah</div></p>" + moreComplex = "Another test @foss_satan@fossbros-anonymous.io\n\n#Hashtag\n\nText\n\n:rainbow:" + moreComplexExpected = "<p>Another test <span class=\"h-card\"><a href=\"http://fossbros-anonymous.io/@foss_satan\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>foss_satan</span></a></span><br><br><a href=\"http://localhost:8080/tags/Hashtag\" class=\"mention hashtag\" rel=\"tag nofollow noreferrer noopener\" target=\"_blank\">#<span>Hashtag</span></a><br><br>Text<br><br>:rainbow:</p>" ) type PlainTestSuite struct { @@ -44,11 +46,21 @@ func (suite *PlainTestSuite) TestParseSimple() { suite.Equal(simpleExpected, formatted.HTML) } +func (suite *PlainTestSuite) TestParseSimpleNoParagraph() { + formatted := suite.FromPlainNoParagraph(simple) + suite.Equal(simpleExpectedNoParagraph, formatted.HTML) +} + func (suite *PlainTestSuite) TestParseWithTag() { formatted := suite.FromPlain(withTag) suite.Equal(withTagExpected, formatted.HTML) } +func (suite *PlainTestSuite) TestParseWithTagNoParagraph() { + formatted := suite.FromPlainNoParagraph(withTag) + suite.Equal(withTagExpectedNoParagraph, formatted.HTML) +} + func (suite *PlainTestSuite) TestParseWithHTML() { formatted := suite.FromPlain(withHTML) suite.Equal(withHTMLExpected, formatted.HTML) |