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
@@ -284,7 +284,10 @@ describe("StatusPage", () => {
|
||||
|
||||
const head = document.querySelector(".page-head.status-head");
|
||||
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(() =>
|
||||
expect(within(head as HTMLElement).getByText(/pi2-box · pi2-box ·/)).toBeInTheDocument(),
|
||||
);
|
||||
@@ -305,6 +308,32 @@ describe("StatusPage", () => {
|
||||
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 () => {
|
||||
mockApi(apiRoutes());
|
||||
await renderPage(routes(), "/status", { paired: true });
|
||||
|
||||
Reference in new issue
Block a user