aboutsummaryrefslogtreecommitdiffstats
path: root/modules/markup/html_test.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2024-11-16 16:41:44 +0800
committerGitHub <noreply@github.com>2024-11-16 08:41:44 +0000
commit5eebe1dc5fb29a162c51d050396fce7b14e47f4e (patch)
tree900ce606dedcc5722ee78429bbbc8eba3466b680 /modules/markup/html_test.go
parente546480d0a2bbd9fcf897d7506a1efe3fa44cef3 (diff)
downloadgitea-5eebe1dc5fb29a162c51d050396fce7b14e47f4e.tar.gz
gitea-5eebe1dc5fb29a162c51d050396fce7b14e47f4e.zip
Fix and refactor markdown rendering (#32522)
Diffstat (limited to 'modules/markup/html_test.go')
-rw-r--r--modules/markup/html_test.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go
index 262d0fc4dd..67ac2758a3 100644
--- a/modules/markup/html_test.go
+++ b/modules/markup/html_test.go
@@ -27,6 +27,11 @@ var (
"user": testRepoOwnerName,
"repo": testRepoName,
}
+ localWikiMetas = map[string]string{
+ "user": testRepoOwnerName,
+ "repo": testRepoName,
+ "markupContentMode": "wiki",
+ }
)
type mockRepo struct {
@@ -413,8 +418,7 @@ func TestRender_ShortLinks(t *testing.T) {
Links: markup.Links{
Base: markup.TestRepoURL,
},
- Metas: localMetas,
- ContentMode: markup.RenderContentAsWiki,
+ Metas: localWikiMetas,
}, input)
assert.NoError(t, err)
assert.Equal(t, strings.TrimSpace(expectedWiki), strings.TrimSpace(string(buffer)))
@@ -526,10 +530,9 @@ func TestRender_ShortLinks(t *testing.T) {
func TestRender_RelativeMedias(t *testing.T) {
render := func(input string, isWiki bool, links markup.Links) string {
buffer, err := markdown.RenderString(&markup.RenderContext{
- Ctx: git.DefaultContext,
- Links: links,
- Metas: localMetas,
- ContentMode: util.Iif(isWiki, markup.RenderContentAsWiki, markup.RenderContentAsComment),
+ Ctx: git.DefaultContext,
+ Links: links,
+ Metas: util.Iif(isWiki, localWikiMetas, localMetas),
}, input)
assert.NoError(t, err)
return strings.TrimSpace(string(buffer))