diff --git a/src/components/insights/__tests__/health-score-card.test.tsx b/src/components/insights/__tests__/health-score-card.test.tsx index ef0ee82e5..0353d7719 100644 --- a/src/components/insights/__tests__/health-score-card.test.tsx +++ b/src/components/insights/__tests__/health-score-card.test.tsx @@ -157,6 +157,31 @@ describe("", () => { ); }); + it("stacks the explainer caption BELOW the delta line, not beside it", () => { + // The caption is a multi-sentence read; rendering it inside the + // delta's inline-flex row squeezed the short delta into a narrow + // multi-line column on every viewport. The wrapper stacks instead. + const html = ssr( + , + ); + const wrapper = html.match( + /data-slot="health-score-card-delta"[^>]*class="([^"]*)"/, + ); + expect(wrapper).not.toBeNull(); + expect(wrapper?.[1]).toContain("space-y-1"); + expect(wrapper?.[1]).not.toContain("inline-flex"); + // The delta line's

closes before the explainer body opens — + // the caption is a sibling below, never a flex neighbour. + expect(html).toMatch( + /vs last week[^<]*<\/span><\/p>]*data-slot="health-score-delta-explainer-body"/, + ); + }); + it("renders four component rows with their values", () => { const html = ssr( {delta === null ? ( - {t("insights.healthScore.deltaUnavailable")} +

{t("insights.healthScore.deltaUnavailable")}

) : ( <> - {delta > 0 && ( -