mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 05:37:20 +08:00
Co-authored-by: Engel Nyst <enyst@users.noreply.github.com> Co-authored-by: sp.wack <83104063+amanape@users.noreply.github.com>
41 lines
1.0 KiB
TypeScript
41 lines
1.0 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { test, expect, describe, vi } from "vitest";
|
|
import { CopyToClipboardButton } from "#/components/shared/buttons/copy-to-clipboard-button";
|
|
|
|
// Mock react-i18next
|
|
vi.mock("react-i18next", () => ({
|
|
useTranslation: () => ({
|
|
t: (key: string) => key,
|
|
}),
|
|
}));
|
|
|
|
describe("CopyToClipboardButton", () => {
|
|
test("should have localized aria-label", () => {
|
|
render(
|
|
<CopyToClipboardButton
|
|
isHidden={false}
|
|
isDisabled={false}
|
|
onClick={() => {}}
|
|
mode="copy"
|
|
/>
|
|
);
|
|
|
|
const button = screen.getByTestId("copy-to-clipboard");
|
|
expect(button).toHaveAttribute("aria-label", "BUTTON$COPY");
|
|
});
|
|
|
|
test("should have localized aria-label when copied", () => {
|
|
render(
|
|
<CopyToClipboardButton
|
|
isHidden={false}
|
|
isDisabled={false}
|
|
onClick={() => {}}
|
|
mode="copied"
|
|
/>
|
|
);
|
|
|
|
const button = screen.getByTestId("copy-to-clipboard");
|
|
expect(button).toHaveAttribute("aria-label", "BUTTON$COPIED");
|
|
});
|
|
});
|