diff --git a/src/app/stats/page.test.tsx b/src/app/stats/page.test.tsx index 24638b1..1b78447 100644 --- a/src/app/stats/page.test.tsx +++ b/src/app/stats/page.test.tsx @@ -236,4 +236,20 @@ describe("Stats page, Visitors view", () => { fireEvent.blur(month); }); + + it("lists the higher series first in the tooltip, like the lines on the chart", () => { + openVisitors(); + + const month = screen.getByRole("img", { name: /November 2026: 1,743 visitors/ }); + fireEvent.focus(month); + const chart = screen.getByRole("group", { name: "Visitors and page views per month" }); + const tooltip = chart.querySelector('[aria-hidden="true"].bg-popover'); + expect(tooltip).not.toBeNull(); + const text = tooltip!.textContent ?? ""; + // Page views are always at least visitors, so they come first and visitors sit below. + expect(text.indexOf("Page views")).toBeGreaterThan(-1); + expect(text.indexOf("Page views")).toBeLessThan(text.indexOf("Visitors")); + + fireEvent.blur(month); + }); }); diff --git a/src/components/traffic/traffic-chart.tsx b/src/components/traffic/traffic-chart.tsx index 65f4933..a18d3bc 100644 --- a/src/components/traffic/traffic-chart.tsx +++ b/src/components/traffic/traffic-chart.tsx @@ -398,7 +398,8 @@ export function TrafficChart({ rows, metrics, kind, valueLabel }: TrafficChartPr {valueLabel ? `, ${valueLabel.toLowerCase()}` : ""}