Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ describe("CreatedKeyDisplay", () => {
expect(screen.getByText("sk-test-123")).toBeInTheDocument();
});

it("should theme the key box with tokens instead of a hardcoded light background", () => {
render(<CreatedKeyDisplay apiKey="sk-test-123" />);

const keyBox = screen.getByText("sk-test-123").parentElement as HTMLElement;

expect(keyBox).not.toHaveAttribute("style");
expect(keyBox).toHaveClass("bg-muted");
});

it("should display the security warning", () => {
render(<CreatedKeyDisplay apiKey="sk-test-123" />);
expect(screen.getByText(/you will not be able to view it again/i)).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,8 @@ const CreatedKeyDisplay: React.FC<CreatedKeyDisplayProps> = ({ apiKey }) => {
</p>

<p className="text-sm text-muted-foreground mt-3 mb-1">Virtual Key:</p>
<div
style={{
background: "#f8f8f8",
padding: "10px",
borderRadius: "5px",
marginBottom: "10px",
}}
>
<pre style={{ wordWrap: "break-word", whiteSpace: "normal", margin: 0 }}>{apiKey}</pre>
<div className="bg-muted rounded-md p-2.5 mb-2.5">
<pre className="m-0 whitespace-normal break-words text-foreground">{apiKey}</pre>
</div>

<CopyToClipboard text={apiKey} onCopy={handleCopy}>
Expand Down
Loading