fix(web): stop doubling the dot modifier on the status page head
`serverDotClass()` already returns the full `dot--<status>` class, but the head fed it to a `DotStatus` prop that prepends `dot--` again, so the dot never matched a status color. Strip the prefix and assert the concrete class (`dot--attention` / `dot--ok`) in the page tests instead of just the size.
This commit is contained in:
1 parent
f549045ed2
commit
ec80ee4bab
2 files changed
+31
-2
No files matched your search
@@ -157,7 +157,7 @@ export function StatusPage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const statusLabel = t(`state.${server.status}`, { defaultValue: server.status });
|
const statusLabel = t(`state.${server.status}`, { defaultValue: server.status });
|
||||||
const headDot = serverDotClass(server.status) as DotStatus;
|
const headDot = serverDotClass(server.status).replace("dot--", "") as DotStatus;
|
||||||
// "updated <relative>" — the prototype's quiet freshness hint in the head.
|
// "updated <relative>" — the prototype's quiet freshness hint in the head.
|
||||||
const updatedAt = info.dataUpdatedAt || null;
|
const updatedAt = info.dataUpdatedAt || null;
|
||||||
const updatedLabel = t("status.updated", {
|
const updatedLabel = t("status.updated", {
|
||||||
|
|||||||
@@ -284,7 +284,10 @@ describe("StatusPage", () => {
|
|||||||
|
|
||||||
const head = document.querySelector(".page-head.status-head");
|
const head = document.querySelector(".page-head.status-head");
|
||||||
expect(head).not.toBeNull();
|
expect(head).not.toBeNull();
|
||||||
expect(head?.querySelector(".dot--lg")).not.toBeNull();
|
await waitFor(() => {
|
||||||
|
const dot = head?.querySelector(".dot--lg");
|
||||||
|
expect(dot).toHaveClass("dot--attention");
|
||||||
|
});
|
||||||
await waitFor(() =>
|
await waitFor(() =>
|
||||||
expect(within(head as HTMLElement).getByText(/pi2-box · pi2-box ·/)).toBeInTheDocument(),
|
expect(within(head as HTMLElement).getByText(/pi2-box · pi2-box ·/)).toBeInTheDocument(),
|
||||||
);
|
);
|
||||||
@@ -305,6 +308,32 @@ describe("StatusPage", () => {
|
|||||||
expect(within(info).queryByText("—")).not.toBeInTheDocument();
|
expect(within(info).queryByText("—")).not.toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("renders the page header dot with dot--ok for a healthy daemon", async () => {
|
||||||
|
mockApi(
|
||||||
|
apiRoutes([
|
||||||
|
{
|
||||||
|
path: "/api/v1/health",
|
||||||
|
handler: () => ({
|
||||||
|
body: {
|
||||||
|
ok: true,
|
||||||
|
checkedAt: Date.now(),
|
||||||
|
items: [{ name: "plugin", ok: true, detail: "connected" }],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
await renderPage(routes(), "/status", { paired: true });
|
||||||
|
await screen.findByText("Server info");
|
||||||
|
|
||||||
|
const head = document.querySelector(".page-head.status-head");
|
||||||
|
expect(head).not.toBeNull();
|
||||||
|
await waitFor(() => {
|
||||||
|
const dot = head?.querySelector(".dot--lg");
|
||||||
|
expect(dot).toHaveClass("dot--ok");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it("counts failed health checks and keeps the per-check list", async () => {
|
it("counts failed health checks and keeps the per-check list", async () => {
|
||||||
mockApi(apiRoutes());
|
mockApi(apiRoutes());
|
||||||
await renderPage(routes(), "/status", { paired: true });
|
await renderPage(routes(), "/status", { paired: true });
|
||||||
|
|||||||
Reference in new issue
Block a user