Answer stability round 1: 0 🔴, 3 🟡 (0 misread); pin dashboard heading and branding, fix stale comment
This commit is contained in:
@@ -75,8 +75,15 @@ test("branding logo + default theme flow through when set", () => {
|
||||
assert.equal(chrome.theme, "dark");
|
||||
});
|
||||
|
||||
test("branding name and sub are translated; an unknown key renders as itself", () => {
|
||||
const t = (key: string): string => (key === "brand.sub" ? "Undertitel" : key);
|
||||
const chrome = buildPluginChrome({ menu: { branding: { name: "Acme", sub: "brand.sub" }, override: {} }, t });
|
||||
assert.equal(chrome.brand.name, "Acme");
|
||||
assert.equal(chrome.brand.sub, "Undertitel");
|
||||
assert.equal(buildPluginChrome({ menu: { branding: { name: "Acme" }, override: {} } }).brand.sub, undefined);
|
||||
});
|
||||
|
||||
test("shellUser derives the profile from the real user; anonymous → Guest", () => {
|
||||
assert.deepEqual(shellUser(null), { email: "", initials: "G", name: "Guest" });
|
||||
// Real user: name = email local part, email kept, initials = first two letters of the local part.
|
||||
assert.deepEqual(shellUser({ email: "ada@example.com", id: "u1", permissions: [] }), { email: "ada@example.com", initials: "AD", name: "ada" });
|
||||
});
|
||||
|
||||
+1
-3
@@ -70,8 +70,7 @@ export function buildPluginChrome(opts: ChromeOptions): PageChrome {
|
||||
};
|
||||
}
|
||||
|
||||
// The User carries no display name (the JWT holds only id/email/permissions), so the profile shows
|
||||
// the email's local part as the name; anonymous ⇒ "Guest".
|
||||
// The JWT holds only id/email/permissions, so the profile name is the email's local part.
|
||||
export function shellUser(user: User | null | undefined, t: Translate = ENGLISH): ShellUser {
|
||||
if (!user) {
|
||||
const guest = t("shell.guest");
|
||||
@@ -81,7 +80,6 @@ export function shellUser(user: User | null | undefined, t: Translate = ENGLISH)
|
||||
return { email: user.email, initials: (local.slice(0, 2) || "U").toUpperCase(), name: local };
|
||||
}
|
||||
|
||||
// `name`/`sub` pass through `t`, so a catalog key is translated and an operator's own wording renders as written.
|
||||
function branding(menu: MenuConfig, t: Translate): { logo?: string; name: string; sub?: string; theme?: string } {
|
||||
const b = menu.branding;
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user