Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions frontend/src/ts/test/test-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1637,15 +1637,22 @@ export function getActiveWordTopAfterAppend(data: string): number {
}

// this means input, delete or composition
function afterAnyTestInput(correctInput: boolean | null): void {
if (
correctInput === true ||
Config.playSoundOnError === "off" ||
Config.blindMode
) {
function afterAnyTestInput(
type: "textInput" | "delete" | "compositionUpdate",
correctInput: boolean | null
): void {
if (type === "textInput") {
if (
correctInput === true ||
Config.playSoundOnError === "off" ||
Config.blindMode
) {
void SoundController.playClick();
} else {
void SoundController.playError();
}
} else if (type === "delete") {
void SoundController.playClick();
} else {
void SoundController.playError();
}

const acc: number = Numbers.roundTo2(TestStats.calculateAccuracy());
Expand Down Expand Up @@ -1684,18 +1691,18 @@ export function afterTestTextInput(
}
}

afterAnyTestInput(correct);
afterAnyTestInput("textInput", correct);
}

export function afterTestCompositionUpdate(): void {
void updateActiveWordLetters();
// correct needs to be true to get the normal click sound
afterAnyTestInput(true);
afterAnyTestInput("compositionUpdate", true);
}

export function afterTestDelete(): void {
void updateActiveWordLetters();
afterAnyTestInput(null);
afterAnyTestInput("delete", null);
}

export function beforeTestWordChange(
Expand Down
Loading