Skip to content
Open
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
5 changes: 5 additions & 0 deletions packages/ui/src/components/code-block.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ describe("CodeBlock — terminal variant", () => {
expect(container.querySelector('[class*="ff5f56"]')).toBeNull();
});

it("renders a copy button, same as the editor variant", () => {
render(<CodeBlock variant="terminal" lang="bash" code={"elide build"} />);
expect(screen.getByRole("button", { name: "Copy" })).toBeInTheDocument();
});

it("falls back to the localized TERMINAL title when no lang is given", () => {
render(<CodeBlock variant="terminal" code={"echo hi"} />);
expect(screen.getByText("Terminal")).toBeInTheDocument();
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/code-block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ export function CodeBlock({
style={elev}
>
<span>{lang ?? m.codeBlock.terminal}</span>
<CopyButton value={code} label="" className="ml-auto px-1.5 py-1" />
</div>
<pre className="m-0 overflow-x-auto p-4 font-mono text-[13px] leading-[1.7] text-[var(--eld-syntax-default)]">
{body}
Expand Down
Loading