2023-12-12 11:32:51 +05:30
|
|
|
import { defaultLang } from "../../packages/excalidraw/i18n";
|
|
|
|
import { UI } from "../../packages/excalidraw/tests/helpers/ui";
|
|
|
|
import {
|
|
|
|
screen,
|
|
|
|
fireEvent,
|
|
|
|
waitFor,
|
|
|
|
render,
|
|
|
|
} from "../../packages/excalidraw/tests/test-utils";
|
2023-09-21 09:28:48 +05:30
|
|
|
|
2023-12-07 16:39:11 +05:30
|
|
|
import ExcalidrawApp from "../App";
|
2023-09-21 09:28:48 +05:30
|
|
|
|
|
|
|
describe("Test LanguageList", () => {
|
|
|
|
it("rerenders UI on language change", async () => {
|
|
|
|
await render(<ExcalidrawApp />);
|
|
|
|
|
|
|
|
// select rectangle tool to show properties menu
|
|
|
|
UI.clickTool("rectangle");
|
|
|
|
// english lang should display `thin` label
|
|
|
|
expect(screen.queryByTitle(/thin/i)).not.toBeNull();
|
|
|
|
fireEvent.click(document.querySelector(".dropdown-menu-button")!);
|
|
|
|
|
|
|
|
fireEvent.change(document.querySelector(".dropdown-select__language")!, {
|
|
|
|
target: { value: "de-DE" },
|
|
|
|
});
|
|
|
|
// switching to german, `thin` label should no longer exist
|
|
|
|
await waitFor(() => expect(screen.queryByTitle(/thin/i)).toBeNull());
|
|
|
|
// reset language
|
|
|
|
fireEvent.change(document.querySelector(".dropdown-select__language")!, {
|
|
|
|
target: { value: defaultLang.code },
|
|
|
|
});
|
|
|
|
// switching back to English
|
|
|
|
await waitFor(() => expect(screen.queryByTitle(/thin/i)).not.toBeNull());
|
|
|
|
});
|
|
|
|
});
|