Save languages to LocalStorage (#52)

* Saving & restoring implemented
This commit is contained in:
David
2021-10-10 21:45:14 +02:00
committed by GitHub
parent 126ded01fd
commit 80a925ab4d
3 changed files with 39 additions and 3 deletions

View File

@@ -156,6 +156,7 @@ describe("Page", () => {
expect(source).toHaveValue(sourceVal);
await waitFor(() => expect(routerPushMock).toHaveBeenCalledTimes(1));
expect(localStorageSetMock).toHaveBeenCalledWith("source", sourceVal);
});
it("doesn't switch the page on language change on the start page", async () => {
@@ -193,6 +194,7 @@ describe("Page", () => {
expect(screen.getByRole("textbox", { name: /translation result/i })).toHaveValue(initial.query);
await waitFor(() => expect(routerPushMock).toHaveBeenCalledTimes(1));
expect(localStorageSetMock).toHaveBeenLastCalledWith("target", initial.source);
});
it("translates & loads initials correctly", async () => {