safety check to stop the test if last word is correct but we are still trying to move on to the next word

This commit is contained in:
Miodec 2023-07-13 15:17:22 +02:00
parent 540f24dc4f
commit 46f4c69e5f

View file

@ -205,6 +205,11 @@ function handleSpace(): void {
Sound.playClick();
}
Replay.addReplayEvent("submitCorrectWord");
if (TestWords.words.currentIndex === TestWords.words.length) {
//submitted last word (checking this in case the test doesnt stop automatically on correct last keypress)
TestLogic.finish();
return;
}
} else {
if (!nospace) {
if (!Config.playSoundOnError || Config.blindMode) {
@ -1159,6 +1164,8 @@ $("#wordsInput").on("input", (event) => {
return;
}
console.log("input", inputValue, currTestInput, realInputValue);
if (realInputValue.length === 0 && currTestInput.length === 0) {
// fallback for when no Backspace keydown event (mobile)
backspaceToPrevious();