feat(centralui): collapsible sidebar nav sections

Make the seven sidebar section groups (Admin, Design, Deployment,
Notifications, Site Calls, Monitoring, Audit) collapsible. New NavSection
component renders a header toggle button (chevron) and reveals its items
only while expanded; NavMenu owns the expanded-section set.

Behaviour: sections are collapsed by default; state persists in the
`scadabridge_nav` cookie (written/read via the new nav-state.js JS interop,
mirroring treeview-storage.js) so it survives reloads and reconnects;
navigating into a section auto-expands it and remembers it. The Dashboard
item stays sectionless and always visible.

Tests: NavMenu bUnit tests expand sections before asserting items and add
collapsed-by-default / toggle / cookie-persistence cases; Playwright nav
tests expand sections before clicking links; new NavCollapseTests covers
the feature E2E. Build 0 warnings; bUnit 545 passed; Playwright nav suite
green (the unrelated AuditGridColumnTests resize-reload case remains
pre-existing flaky — an un-awaited save race in that test).
This commit is contained in:
Joseph Doherty
2026-05-22 07:36:57 -04:00
parent d4abacc0d8
commit 86ee7bd1a8
11 changed files with 511 additions and 95 deletions

View File

@@ -105,6 +105,28 @@ public class PlaywrightFixture : IAsyncLifetime
: $"() => window.location.pathname.includes('{path}')";
await page.WaitForFunctionAsync(js, null, new() { Timeout = timeoutMs });
}
/// <summary>
/// Expand every collapsed sidebar nav section. Nav sections are collapsed by
/// default, so a section's links are not in the DOM until it is expanded.
/// Call this after authenticating, before interacting with sectioned nav links.
/// </summary>
public static async Task ExpandAllNavSectionsAsync(IPage page)
{
var toggles = page.Locator("button.nav-section-toggle");
int count = await toggles.CountAsync();
for (int i = 0; i < count; i++)
{
var toggle = toggles.Nth(i);
if (await toggle.GetAttributeAsync("aria-expanded") == "false")
{
await toggle.ClickAsync();
// Wait for the toggle's own state to flip so the Blazor
// re-render has landed before moving to the next section.
await Assertions.Expect(toggle).ToHaveAttributeAsync("aria-expanded", "true");
}
}
}
}
[CollectionDefinition("Playwright")]