fix(typig test): blind mode not highlighting missed characters as correct

(turns out that "old unused code" was actually quite important)
This commit is contained in:
Miodec 2024-06-11 14:25:28 +02:00
parent 28a397ecf2
commit 4e46f6bc9f
2 changed files with 14 additions and 3 deletions

View file

@ -267,8 +267,14 @@ async function handleSpace(): Promise<void> {
return;
}
PaceCaret.handleSpace(false, currentWord);
if (Config.blindMode) {
if (Config.highlightMode !== "off") {
TestUI.highlightAllLettersAsCorrect(TestUI.currentWordElementIndex);
}
} else {
TestUI.highlightBadWord(TestUI.currentWordElementIndex);
}
TestInput.input.pushHistory();
TestUI.highlightBadWord(TestUI.currentWordElementIndex, !Config.blindMode);
TestWords.words.increaseCurrentIndex();
Funbox.toggleScript(TestWords.words.getCurrent());
TestInput.incrementKeypressCount();

View file

@ -1408,11 +1408,16 @@ export async function applyBurstHeatmap(): Promise<void> {
}
}
export function highlightBadWord(index: number, showError: boolean): void {
if (!showError) return;
export function highlightBadWord(index: number): void {
$($("#words .word")[index] as HTMLElement).addClass("error");
}
export function highlightAllLettersAsCorrect(wordIndex: number): void {
$($("#words .word")[wordIndex] as HTMLElement)
.find("letter")
.addClass("correct");
}
export function highlightMode(mode?: SharedTypes.Config.HighlightMode): void {
const existing =
$("#words")