Files
HealthLog/src/components/ui/__tests__/sheet-header.test.tsx
T
Marc-André Bombeck 6d83115d16 chore(release): v1.28.43 — visual consistency polish
Verified UI-consistency findings from the campaign's design audit, each
pixel-faithful except the intended correction:

- insights hero band: off-scale py-5/gap-5 → the standard scale; H1
  font-semibold → font-bold; sm:text-[28px] → sm:text-3xl.
- medication-compliance-chart + recent-achievements-card: hand-rolled
  muted h-4 icon + text-sm headers → the standard TileHeader primitive so
  they match sibling tiles.
- achievements stat tiles + clinician-view shells: p-5 → p-4 md:p-6.
- two text-primary header glyphs (research-mode dialog, enroll-mfa) →
  text-foreground (never accent on a header glyph); the deliberate
  badge-boxed icons left untouched.
- SheetHeader now reserves the trailing close-X gutter like DialogHeader,
  closing the latent overlap class for future raw-Sheet consumers.
- five raw Dialogs on phone-reachable surfaces → ResponsiveSheet.
- new bg-card-scoped healthlog/spacing-scale lint (flags p-5/gap-5 etc.
  only on card shells; list-marker insets + half-steps excluded) at error,
  with the five offenders it flagged swept.
- dropped the stale CLAUDE.md '18 PascalCase outliers' line (0 remain).

Every data-slot preserved. No migration.
2026-07-16 03:44:00 +02:00

31 lines
1.2 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { renderToStaticMarkup } from "react-dom/server";
import { SheetHeader } from "../sheet";
/**
* The raw `SheetHeader` reserves a trailing gutter for the sheet's absolute
* close-X the way `DialogHeader` (pr-9) does — sized to the sheet close
* button (`right-4`, min-w-9…11) so a long raw-`<Sheet>` title never slides
* under the X. Latent hardening (every current consumer passes its own
* header/close), but it forecloses the Documents-class overlap at the
* primitive. Consumers that render no close-X drop the reserve via className,
* and tailwind-merge keeps the later value.
*/
describe("<SheetHeader>", () => {
it("reserves the trailing close-X gutter (pr-12) by default", () => {
const html = renderToStaticMarkup(<SheetHeader>Title</SheetHeader>);
expect(html).toContain('data-slot="sheet-header"');
expect(html).toContain("pr-12");
});
it("lets a consumer className override the reserve", () => {
const html = renderToStaticMarkup(
<SheetHeader className="p-3">Title</SheetHeader>,
);
// A later padding utility from the consumer wins under tailwind-merge.
expect(html).toContain("p-3");
expect(html).not.toMatch(/class="[^"]*\bpr-12\b/);
});
});