Answer stability round 1: 1 🔴, 3 🟡 (0 misread); scope the visual selector, check label and cover the gaps

This commit is contained in:
2026-11-08 19:25:57 +01:00
parent 6767a5d7bd
commit 523e8b3724
6 changed files with 11 additions and 6 deletions
+3 -3
View File
@@ -96,18 +96,18 @@ const account: Plugin = {
{ href: "/account/help", label: "Help", public: true },
],
};
const entries = (opts: { permissions?: string[]; signedIn?: boolean }): { href: string; label: string }[] =>
const entries = (opts: { permissions?: string[]; signedIn?: boolean }): { href: string; icon?: string; label: string }[] =>
buildPluginChrome({
localeHref: (href) => `${href}?locale=sv-SE`,
menu: DEFAULT_MENU,
plugins: [account],
translatorFor: () => (key) => (key === "account.settings" ? "Inställningar" : key),
...(opts.signedIn === false ? {} : { user: { email: "ada@x.io", id: "u1", permissions: opts.permissions ?? [] } }),
}).user.menu!.map(({ href, label }) => ({ href, label }));
}).user.menu!;
test("profile menu entries are gated like nav nodes, translated by their plugin and carry the locale", () => {
assert.deepEqual(entries({}), [
{ href: "/account/settings?locale=sv-SE", label: "Inställningar" },
{ href: "/account/settings?locale=sv-SE", icon: "i-user", label: "Inställningar" },
{ href: "/account/help?locale=sv-SE", label: "Help" },
]);
assert.deepEqual(entries({ permissions: ["billing:read"] }).map((e) => e.label), ["Inställningar", "account.billing", "Help"]);