Generic user_bottom wiki block
This commit is contained in:
@@ -59,8 +59,11 @@ func TestBuildNativeGeneratesAndSkipsWikiPages(t *testing.T) {
|
||||
if strings.Contains(text, "[//]: #") || strings.Contains(text, "<WRAP>") {
|
||||
t.Fatalf("expected generated HTML to omit DokuWiki-era syntax:\n%s", text)
|
||||
}
|
||||
if !strings.Contains(text, `<!-- sow-topdata-wiki:manual:start id="notes" -->`) || !strings.Contains(text, "<h2>See Also</h2>") {
|
||||
t.Fatalf("expected generated page to include manual section placeholders:\n%s", text)
|
||||
if !strings.Contains(text, `<!-- sow-topdata-wiki:manual:start id="user_bottom" -->`) {
|
||||
t.Fatalf("expected generated page to include user_bottom manual section placeholder:\n%s", text)
|
||||
}
|
||||
if strings.Contains(text, `manual:start id="notes"`) || strings.Contains(text, `manual:start id="see_also"`) || strings.Contains(text, "<h2>See Also</h2>") {
|
||||
t.Fatalf("expected generated page to omit legacy split bottom manual sections:\n%s", text)
|
||||
}
|
||||
statusPath := filepath.Join(root, ".cache", "wiki", "pages", "meta", "wikistatus.html")
|
||||
statusRaw, err := os.ReadFile(statusPath)
|
||||
@@ -130,6 +133,26 @@ func countGeneratedWikiHTMLFiles(t *testing.T, root string) int {
|
||||
return count
|
||||
}
|
||||
|
||||
func TestDefaultWikiManualSectionsUseSingleUserBottomBlock(t *testing.T) {
|
||||
sections := defaultWikiManualSections()
|
||||
if len(sections) != 2 {
|
||||
t.Fatalf("expected top and bottom manual sections only, got %#v", sections)
|
||||
}
|
||||
expected := map[string]string{
|
||||
"user_top": "UserTopSection",
|
||||
"user_bottom": "UserBottomSection",
|
||||
}
|
||||
for _, section := range sections {
|
||||
alias, ok := expected[section.ID]
|
||||
if !ok {
|
||||
t.Fatalf("unexpected default manual section %#v", section)
|
||||
}
|
||||
if section.Alias != alias {
|
||||
t.Fatalf("expected alias %q for %q, got %q", alias, section.ID, section.Alias)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestWikiClassNamePrefersFullNameInsteadOfShortCode(t *testing.T) {
|
||||
ctx := &wikiContext{}
|
||||
got := ctx.resolveRowName("classes", map[string]any{
|
||||
@@ -158,7 +181,7 @@ func TestWikiTemplateRendersFieldsFormattersAndPreservedTopSection(t *testing.T)
|
||||
},
|
||||
ManualSections: []wikiManualSection{
|
||||
{ID: "user_top", Alias: "UserTopSection", InitialHTML: "<p></p>"},
|
||||
{ID: "notes", Alias: "UserBottomSection", InitialHTML: "<h2>Notes</h2><p></p>"},
|
||||
{ID: "user_bottom", Alias: "UserBottomSection", InitialHTML: "<p></p>"},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -181,7 +204,7 @@ func TestWikiTemplateRendersFieldsFormattersAndPreservedTopSection(t *testing.T)
|
||||
"<p>Skill Points: 4</p>",
|
||||
"This is a new class!",
|
||||
"<p>Acolyte description.</p>",
|
||||
`<!-- sow-topdata-wiki:manual:start id="notes" -->`,
|
||||
`<!-- sow-topdata-wiki:manual:start id="user_bottom" -->`,
|
||||
} {
|
||||
if !strings.Contains(got, expected) {
|
||||
t.Fatalf("expected %q in rendered template:\n%s", expected, got)
|
||||
|
||||
Reference in New Issue
Block a user