Generate navigation and render page embeds from PocketBase

This commit is contained in:
tleininger committed 2026-09-23 14:54:10 +02:00
1 parent 6b5d9dda55
commit 3fd3796d73
26 files changed
+544 -114

No files matched your search

+43
View File
@@ -98,4 +98,47 @@ public sealed class RouteSmokeTests : IDisposable
html.ShouldContain("Wann gibt es Mittagessen?");
html.ShouldContain("Mensa und Mittagessen"); // German topic heading
}
[Fact]
public async Task Layout_navigation_is_built_from_the_pages()
{
// The header and footer menus are generated from the "pages" records, not
// hard-coded. Assert a header link, a footer link, and that the non-public
// draft page never leaks into the menu.
var client = _factory.CreateClient();
var html = await client.GetStringAsync(new Uri("/", UriKind.Relative));
html.ShouldContain("href=\"/board\""); // header page
html.ShouldContain("href=\"/imprint\""); // footer page
html.ShouldNotContain("href=\"/draft\""); // public=false, filtered out
}
[Fact]
public async Task Home_renders_the_embeds_its_page_opts_into()
{
// The home page's embed field is ["posts","events"], so the root route
// renders the posts teaser and the events teaser below the intro.
var client = _factory.CreateClient();
var html = await client.GetStringAsync(new Uri("/", UriKind.Relative));
html.ShouldContain("Aktuelle Beiträge"); // posts embed heading
html.ShouldContain("Neuer Vorstand"); // a seeded post title
html.ShouldContain("Kommende Termine"); // events embed heading
}
[Fact]
public async Task Content_page_renders_the_embed_its_page_opts_into()
{
// /patrons is a catch-all content page whose embed field is ["faqs"], so it
// shows its body plus the FAQ teaser -- proving the ContentPage embed path.
var client = _factory.CreateClient();
var html = await client.GetStringAsync(new Uri("/patrons", UriKind.Relative));
html.ShouldContain("Förderverein"); // the page body
html.ShouldContain("Häufige Fragen"); // faqs embed heading
html.ShouldContain("Wann gibt es Mittagessen?"); // a seeded question
}
}