From 6ec259a0e71174651bae95d4628138bf6fd68742 Mon Sep 17 00:00:00 2001 From: kj_sh604 Date: Sun, 15 Mar 2026 16:19:35 -0400 Subject: refactor: packages/ --- packages/excalidraw/components/Trans.test.tsx | 72 +++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 packages/excalidraw/components/Trans.test.tsx (limited to 'packages/excalidraw/components/Trans.test.tsx') diff --git a/packages/excalidraw/components/Trans.test.tsx b/packages/excalidraw/components/Trans.test.tsx new file mode 100644 index 0000000..c331796 --- /dev/null +++ b/packages/excalidraw/components/Trans.test.tsx @@ -0,0 +1,72 @@ +import { render } from "@testing-library/react"; + +import fallbackLangData from "../locales/en.json"; + +import Trans from "./Trans"; +import type { TranslationKeys } from "../i18n"; +import { EditorJotaiProvider } from "../editor-jotai"; + +describe("Test ", () => { + it("should translate the the strings correctly", () => { + //@ts-ignore + fallbackLangData.transTest = { + key1: "Hello {{audience}}", + key2: "Please click the button to continue.", + key3: "Please click {{location}} to continue.", + key4: "Please click {{location}} to continue.", + key5: "Please click the button to continue.", + }; + + const { getByTestId } = render( + +
+ +
+
+ {el}} + /> +
+
+ {el}} + location="the button" + /> +
+
+ {el}} + location="the button" + bold={(el) => {el}} + /> +
+
+ {el}} + /> +
+
, + ); + + expect(getByTestId("test1").innerHTML).toEqual("Hello world"); + expect(getByTestId("test2").innerHTML).toEqual( + `Please click the button to continue.`, + ); + expect(getByTestId("test3").innerHTML).toEqual( + `Please click the button to continue.`, + ); + expect(getByTestId("test4").innerHTML).toEqual( + `Please click the button to continue.`, + ); + expect(getByTestId("test5").innerHTML).toEqual( + `Please click the button to continue.`, + ); + }); +}); -- cgit v1.2.3