Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
+48
@@ -0,0 +1,48 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
import { Colors } from "~/application/enums/shared/Colors";
|
||||
import RowSelectedOptionCell from "./RowSelectedOptionCell";
|
||||
|
||||
const translations: Record<string, string> = {
|
||||
"models.contact.status.options.customer": "Kunde",
|
||||
};
|
||||
|
||||
vi.mock("react-i18next", () => ({
|
||||
useTranslation: () => ({
|
||||
t: (key: string) => translations[key] ?? key,
|
||||
i18n: {
|
||||
exists: (key: string) => key in translations,
|
||||
},
|
||||
}),
|
||||
}));
|
||||
|
||||
describe("RowSelectedOptionCell", () => {
|
||||
it("renders seed select option labels through model translation fallbacks", () => {
|
||||
render(
|
||||
<RowSelectedOptionCell
|
||||
value="customer"
|
||||
entityName="contact"
|
||||
propertyName="status"
|
||||
display="Name"
|
||||
options={[{ value: "customer", name: "Customer", color: Colors.GREEN }]}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText("Kunde")).toBeTruthy();
|
||||
expect(screen.queryByText("Customer")).toBeNull();
|
||||
});
|
||||
|
||||
it("keeps custom option labels literal when no model translation exists", () => {
|
||||
render(
|
||||
<RowSelectedOptionCell
|
||||
value="vip"
|
||||
entityName="contact"
|
||||
propertyName="status"
|
||||
display="Name"
|
||||
options={[{ value: "vip", name: "VIP customer", color: Colors.YELLOW }]}
|
||||
/>
|
||||
);
|
||||
|
||||
expect(screen.getByText("VIP customer")).toBeTruthy();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user