Serve the home nav link from PocketBase, not a hard-coded copy
This commit is contained in:
1 parent
1bdb026669
commit
3fd4068762
8 files changed
+26
-40
No files matched your search
@@ -19,7 +19,6 @@ public class NavBuilderTests
|
||||
Page("board", "header", 2, "Vorstandsteam"),
|
||||
Page("home", "header", 1, "Start"),
|
||||
Page("imprint", "footer", 1, "Impressum"),
|
||||
Page("hidden", "", 1, "Unterseite"),
|
||||
};
|
||||
|
||||
var header = NavBuilder.Header(pages);
|
||||
@@ -56,13 +55,4 @@ public class NavBuilderTests
|
||||
header[0].Href.ShouldBe("/");
|
||||
header[1].Href.ShouldBe("/board");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Pages_without_a_location_never_appear_in_a_menu()
|
||||
{
|
||||
var pages = new[] { Page("hidden", "", 1, "Unterseite") };
|
||||
|
||||
NavBuilder.Header(pages).ShouldBeEmpty();
|
||||
NavBuilder.Footer(pages).ShouldBeEmpty();
|
||||
}
|
||||
}
|
||||
@@ -85,9 +85,9 @@ public sealed class PocketBaseClientTests(PocketBaseFixture pocketBase)
|
||||
|
||||
var home = pages.Single(p => p.Slug == "home");
|
||||
home.Embed.ShouldBe(["posts", "events"], ignoreOrder: true);
|
||||
// Home has no menu slot: the brand is the home link, so a "Start" nav
|
||||
// entry would be redundant. NavBuilder filters it out via this empty value.
|
||||
home.Location.ShouldBe("");
|
||||
// Home sits in the header like every other page (location is required); it
|
||||
// is the single source of the home nav link.
|
||||
home.Location.ShouldBe("header");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -220,14 +220,14 @@ public sealed class PocketBaseFixture : IAsyncLifetime
|
||||
private static async Task SeedRecordsAsync(HttpClient http)
|
||||
{
|
||||
// Pages that the route smoke tests reach through the navigation, the
|
||||
// footer or the FAQ hub. Header pages carry a location+order; the FAQ
|
||||
// sub-pages are plain content pages without a menu slot. All public.
|
||||
// The home page has no menu slot (location ""): the site brand is the home
|
||||
// link, so a separate "Start" nav entry would be redundant.
|
||||
// footer or the FAQ hub. Every page carries a location ("header" or
|
||||
// "footer") -- the field is required, matching production. All public.
|
||||
// The home page sits in the header at order 1, like production; the brand
|
||||
// links home too, but the nav entry is the single source of the home link.
|
||||
await CreateRecordAsync(http, "pages", new
|
||||
{
|
||||
title = "Startseite", body = "# Willkommen", location = "",
|
||||
order = 0, slug = "home", embed = new[] { "posts", "events" }, @public = true,
|
||||
title = "Start", body = "# Willkommen", location = "header",
|
||||
order = 1, slug = "home", embed = new[] { "posts", "events" }, @public = true,
|
||||
});
|
||||
await CreateRecordAsync(http, "pages", new
|
||||
{
|
||||
@@ -253,10 +253,13 @@ public sealed class PocketBaseFixture : IAsyncLifetime
|
||||
title = "Downloads", body = "# Downloads", location = "header",
|
||||
order = 5, slug = "downloads", embed = Array.Empty<string>(), @public = true,
|
||||
});
|
||||
// A plain content page reached only by its slug (not shown in the header),
|
||||
// so the catch-all "/{slug}" ContentPage route stays covered. It carries a
|
||||
// valid location because the field is required; footer keeps it low-key.
|
||||
await CreateRecordAsync(http, "pages", new
|
||||
{
|
||||
title = "FAQ Mensa", body = "# Mensa", location = "",
|
||||
order = 0, slug = "faq-lunch", embed = Array.Empty<string>(), @public = true,
|
||||
title = "FAQ Mensa", body = "# Mensa", location = "footer",
|
||||
order = 9, slug = "faq-lunch", embed = Array.Empty<string>(), @public = true,
|
||||
});
|
||||
await CreateRecordAsync(http, "pages", new
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user