Skip to content

Commit d87e84f

Browse files
committed
health: wrap the misconfigured detail instead of truncating it
The remediation text is the payload - the enable-API console link was clipped by the one-line truncate. The scenario now asserts the text wraps un-clipped and the link sits inside the visible box.
1 parent ee67b0e commit d87e84f

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

e2e/scenarios/google-disabled-api.test.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ scenario(
304304
await step(
305305
"The row carries Google's own instruction, console link included",
306306
async () => {
307-
await connections.getByText(/has not been used in project/).waitFor();
307+
const detail = connections.getByText(/has not been used in project/);
308+
await detail.waitFor();
308309
const consoleLink = connections.getByRole("link", {
309310
name: /console\.developers\.google\.com/,
310311
});
@@ -313,6 +314,22 @@ scenario(
313314
await consoleLink.getAttribute("href"),
314315
"the enable-API console link is clickable",
315316
).toContain("console.developers.google.com");
317+
// Visible in FULL, not just present in the DOM: a one-line
318+
// truncate keeps the link in the tree while clipping it from
319+
// view, which is exactly the regression this guards against.
320+
// A clipped element overflows horizontally; a wrapped one
321+
// grows taller instead.
322+
const clipped = await detail.evaluate(
323+
(el) =>
324+
el.scrollWidth > el.clientWidth + 1 || el.scrollHeight > el.clientHeight + 1,
325+
);
326+
expect(clipped, "the remediation text wraps instead of clipping").toBe(false);
327+
const linkVisible = await consoleLink.evaluate((el) => {
328+
const rect = el.getBoundingClientRect();
329+
const detailRect = el.closest("p")?.getBoundingClientRect();
330+
return detailRect ? rect.right <= detailRect.right + 1 : false;
331+
});
332+
expect(linkVisible, "the console link sits inside the visible detail box").toBe(true);
316333
},
317334
);
318335

packages/react/src/components/accounts-section.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,13 @@ function AccountRow(props: {
192192
</CardStackEntryDescription>
193193
) : null}
194194
{misconfigured && probe?.detail ? (
195-
<CardStackEntryDescription className="mt-1 text-xs text-muted-foreground">
195+
// Not CardStackEntryDescription: that truncates to one line, and this
196+
// text IS the remediation (the enable-API console link must stay
197+
// visible in full). Wrap instead; break anywhere so the long URL
198+
// cannot overflow the row.
199+
<p className="mt-1 whitespace-normal text-xs text-muted-foreground [overflow-wrap:anywhere]">
196200
<DetailWithLinks text={probe.detail} />
197-
</CardStackEntryDescription>
201+
</p>
198202
) : null}
199203
{needsReconsent ? (
200204
<CardStackEntryDescription className="mt-1 text-xs text-muted-foreground">

0 commit comments

Comments
 (0)