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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { setupComponentTest } from "../../../../test/setup";
setupComponentTest();

import { describe, expect, it } from "bun:test";
import { render } from "@testing-library/react";
import "@testing-library/jest-dom";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P3: Redundant import "@testing-library/jest-dom" — the setup file already registers jest-dom matchers via expect.extend(matchers) for bun:test, and the type augmentation is already declared in the setup. The side-effect import does nothing in a bun environment and should be removed to avoid misleading future readers.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/mesh/src/web/routes/commerce-onboarding/companion-forms/selectable-list.test.tsx, line 6:

<comment>Redundant `import "@testing-library/jest-dom"` — the setup file already registers jest-dom matchers via `expect.extend(matchers)` for bun:test, and the type augmentation is already declared in the setup. The side-effect import does nothing in a bun environment and should be removed to avoid misleading future readers.</comment>

<file context>
@@ -0,0 +1,26 @@
+
+import { describe, expect, it } from "bun:test";
+import { render } from "@testing-library/react";
+import "@testing-library/jest-dom";
+import { SelectableList } from "./selectable-list.tsx";
+
</file context>

import { SelectableList } from "./selectable-list.tsx";

describe("SelectableList", () => {
it("constrains long option labels so they truncate inside the row", () => {
const longLabel =
"https://www.example.com/a/very/long/google/search/console/site/url/that/should/not/stretch/the/dialog";

const { getByRole, getByText } = render(
<SelectableList
options={[{ value: "site", label: longLabel }]}
value="site"
onChange={() => {}}
ariaLabel="Site verificado"
/>,
);

expect(getByRole("radio", { name: longLabel })).toHaveClass("min-w-0");
expect(getByText(longLabel)).toHaveClass("min-w-0", "flex-1", "truncate");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,15 @@ export function SelectableList({
onClick={() => onChange(option.value)}
onKeyDown={handleKeyDown}
className={cn(
"flex w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm",
"flex min-w-0 w-full items-center justify-between gap-2 rounded-sm px-2 py-2 text-left text-sm",
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
"disabled:pointer-events-none disabled:opacity-50",
selected
? "bg-muted font-medium text-foreground"
: "text-foreground hover:bg-muted/50",
)}
>
<span className="truncate">{option.label}</span>
<span className="min-w-0 flex-1 truncate">{option.label}</span>
{selected ? (
<CheckCircle size={16} className="shrink-0 text-primary" />
) : null}
Expand Down
Loading