You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
web/src/lib/cards/CardLayout.tsx exports 8 layout primitives used broadly across card components:
CardBody, CardBodyLoaded, CardBodyEmpty
CardScrollList
CardHeaderRow, CardHeaderActions
CardStatGrid, CardStatHeader
These primitives own the canonical Tailwind class strings that guarantee consistent card layout (min-h-card, content-loaded, flex flex-col, grid grid-cols-2 mb-4, etc.). They are consumed by ArgoCDApplications.tsx, ArgoCDApplicationSets.tsx, CRDHealth.tsx, ClusterComparison.tsx and many more (recent PR #22357 adds even more CardStatGrid consumers).
Despite their central role, there is no CardLayout.test.tsx in web/src/lib/cards/. Every consumer test mocks these primitives out with plain <div>s, so:
A silent regression to the class strings (e.g. dropping min-h-card or flipping content-loaded) would not fail any test.
The className merge semantics (via cn(...)) — where callers append responsive breakpoints like @md:grid-cols-3 — is entirely uncovered.
Recommendation
Add web/src/lib/cards/CardLayout.test.tsx with lightweight @testing-library/react render tests that assert, for each exported primitive:
It renders as a <div> and forwards children.
The canonical base classes are present (e.g. CardBody contains min-h-card, flex, flex-col; CardStatGrid contains grid grid-cols-2 mb-4; CardBodyEmpty contains items-center justify-center text-muted-foreground).
A caller-supplied className is merged onto (not replacing) the base classes.
Additional DivProps (e.g. data-testid, role, onClick) are forwarded to the root <div>.
This is a small, self-contained test file (~120 LOC) and lands purely in web/. It runs under the existing vitest web test job — no CI wiring changes required.
Priority
Impact: medium (guards the layout contract for 20+ consumer cards; catches silent Tailwind-class regressions)
Effort: low (single test file, no fixtures, no async)
Finding
web/src/lib/cards/CardLayout.tsxexports 8 layout primitives used broadly across card components:CardBody,CardBodyLoaded,CardBodyEmptyCardScrollListCardHeaderRow,CardHeaderActionsCardStatGrid,CardStatHeaderThese primitives own the canonical Tailwind class strings that guarantee consistent card layout (
min-h-card,content-loaded,flex flex-col,grid grid-cols-2 mb-4, etc.). They are consumed byArgoCDApplications.tsx,ArgoCDApplicationSets.tsx,CRDHealth.tsx,ClusterComparison.tsxand many more (recent PR #22357 adds even moreCardStatGridconsumers).Despite their central role, there is no
CardLayout.test.tsxinweb/src/lib/cards/. Every consumer test mocks these primitives out with plain<div>s, so:min-h-cardor flippingcontent-loaded) would not fail any test.CardStatGridin [scanner] refactor: centralize repeated code patterns #22352 #22357) already have to keep repeating mock stubs — a single canonical test on the primitive itself prevents drift between mocks and reality.classNamemerge semantics (viacn(...)) — where callers append responsive breakpoints like@md:grid-cols-3— is entirely uncovered.Recommendation
Add
web/src/lib/cards/CardLayout.test.tsxwith lightweight@testing-library/reactrender tests that assert, for each exported primitive:<div>and forwardschildren.CardBodycontainsmin-h-card,flex,flex-col;CardStatGridcontainsgrid grid-cols-2 mb-4;CardBodyEmptycontainsitems-center justify-center text-muted-foreground).classNameis merged onto (not replacing) the base classes.DivProps(e.g.data-testid,role,onClick) are forwarded to the root<div>.This is a small, self-contained test file (~120 LOC) and lands purely in
web/. It runs under the existingvitestweb test job — no CI wiring changes required.Priority
Filed by quality agent (ACMM L4/L6 — full mode)