Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

fix(alerts-table): trigger token box and copy to clipboard icon #85

Merged
merged 5 commits into from
Jan 16, 2025
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
2 changes: 1 addition & 1 deletion src/components/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const wrapObjectOutput = (input: AlertConversation["trigger_string"]) => {
if (data === null) return "N/A";
if (typeof data === "string") {
return (
<div className="bg-gray-25 rounded-lg overflow-auto w-fit p-1">
<div className="bg-gray-25 rounded-lg overflow-auto p-4">
<Markdown>{data}</Markdown>
</div>
);
Expand Down
6 changes: 3 additions & 3 deletions src/components/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function Markdown({ children, isInverted = false }: Props) {
const language = match ? match[1] : detectedLanguage;
return (
<div
className="relative group w-full ml-0 my-4"
className="relative group w-full ml-0"
data-testid="syntax-highlighter"
>
<SyntaxHighlighter
Expand All @@ -79,10 +79,10 @@ export function Markdown({ children, isInverted = false }: Props) {
>
{String(children).replace(/\n$/, "")}
</SyntaxHighlighter>
{match && (
{language && (
<CopyToClipboard
text={String(children).replace(/\n$/, "")}
className="absolute top-4 right-8"
className="absolute top-1 right-1"
/>
)}
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/__tests__/Dashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ describe("Dashboard", () => {
}),
).toBeVisible();

userEvent.type(screen.getByRole("searchbox"), "codegate-secrets");
await userEvent.type(screen.getByRole("searchbox"), "codegate-secrets");

await waitFor(() =>
waitFor(() =>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to await the promise returned by waitFor, as it can continue to run after the test has exited, and we may miss the result assertions that are happening within it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
waitFor(() =>
await waitFor(() =>

expect(screen.getByTestId(/alerts-count/i)).toHaveTextContent("1"),
);
const row = within(screen.getByTestId("alerts-table")).getAllByRole(
Expand Down
Loading