From e1b84240707caf94b46caa5a815d4bff2aa72fe3 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 6 Nov 2023 13:30:19 +0000 Subject: [PATCH] refactor: move test restarting to the config event observer --- frontend/src/ts/commandline/lists/languages.ts | 2 -- frontend/src/ts/test/test-logic.ts | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/ts/commandline/lists/languages.ts b/frontend/src/ts/commandline/lists/languages.ts index 6a43173b6..3559055e2 100644 --- a/frontend/src/ts/commandline/lists/languages.ts +++ b/frontend/src/ts/commandline/lists/languages.ts @@ -1,5 +1,4 @@ import * as UpdateConfig from "../../config"; -import * as TestLogic from "../../test/test-logic"; import { capitalizeFirstLetterOfEachWord } from "../../utils/misc"; const subgroup: MonkeyTypes.CommandsSubgroup = { @@ -31,7 +30,6 @@ function update(languages: string[]): void { configValue: language, exec: (): void => { UpdateConfig.setLanguage(language); - TestLogic.restart(); }, }); }); diff --git a/frontend/src/ts/test/test-logic.ts b/frontend/src/ts/test/test-logic.ts index 6a78fccf4..2e8917359 100644 --- a/frontend/src/ts/test/test-logic.ts +++ b/frontend/src/ts/test/test-logic.ts @@ -1519,6 +1519,9 @@ $("header").on("click", "nav #startTestButton, #logo", () => { ConfigEvent.subscribe((eventKey, eventValue, nosave) => { if (ActivePage.get() === "test") { + if (eventKey === "language") { + restart(); + } if (eventKey === "difficulty" && !nosave) restart(); if (eventKey === "showAllLines" && !nosave) restart(); if (eventKey === "tapeMode" && !nosave) restart();