[codex] show complete approval details (#4111)
This commit is contained in:
1 parent
946b867666
commit
a135f2c2d3
4 files changed
+81
-2
No files matched your search
@@ -0,0 +1,28 @@
|
||||
import { ApprovalRequestId } from "@t3tools/contracts";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { ComposerPendingApprovalPanel } from "./ComposerPendingApprovalPanel";
|
||||
|
||||
describe("ComposerPendingApprovalPanel", () => {
|
||||
it("renders complete multiline command details without hover or truncation", () => {
|
||||
const detail = `bun run release -- ${"long-argument ".repeat(20)}\nsecond line`;
|
||||
const markup = renderToStaticMarkup(
|
||||
<ComposerPendingApprovalPanel
|
||||
approval={{
|
||||
requestId: ApprovalRequestId.make("approval-1"),
|
||||
requestKind: "command",
|
||||
createdAt: "2026-07-18T00:00:00.000Z",
|
||||
detail,
|
||||
}}
|
||||
pendingCount={1}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(markup).toContain('data-approval-detail="complete"');
|
||||
expect(markup).toContain('aria-label="Command"');
|
||||
expect(markup).toContain(detail);
|
||||
expect(markup).not.toContain("truncate");
|
||||
expect(markup).not.toContain("line-clamp");
|
||||
});
|
||||
});
|
||||
@@ -16,6 +16,12 @@ export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprova
|
||||
: approval.requestKind === "file-read"
|
||||
? "File-read approval requested"
|
||||
: "File-change approval requested";
|
||||
const detailLabel =
|
||||
approval.requestKind === "command"
|
||||
? "Command"
|
||||
: approval.requestKind === "file-read"
|
||||
? "File to read"
|
||||
: "File change";
|
||||
|
||||
return (
|
||||
<div className="px-4 py-3.5 sm:px-5 sm:py-4">
|
||||
@@ -26,6 +32,18 @@ export const ComposerPendingApprovalPanel = memo(function ComposerPendingApprova
|
||||
<span className="text-xs text-muted-foreground">1/{pendingCount}</span>
|
||||
) : null}
|
||||
</div>
|
||||
{approval.detail ? (
|
||||
<div className="mt-3 rounded-lg border border-border/65 bg-background/70 p-3">
|
||||
<p className="text-xs font-medium text-muted-foreground">{detailLabel}</p>
|
||||
<pre
|
||||
aria-label={detailLabel}
|
||||
className="mt-2 max-h-40 overflow-auto whitespace-pre-wrap break-words font-mono text-xs leading-relaxed text-foreground"
|
||||
data-approval-detail="complete"
|
||||
>
|
||||
{approval.detail}
|
||||
</pre>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
});
|
||||
Reference in new issue
Block a user