diff --git a/src/js/input-controller.js b/src/js/input-controller.js
index 8d340f016..a6feb8058 100644
--- a/src/js/input-controller.js
+++ b/src/js/input-controller.js
@@ -287,7 +287,7 @@ function handleSpace(event, isEnter) {
if (Config.stopOnError != "off") {
if (Config.difficulty == "expert" || Config.difficulty == "master") {
//failed due to diff when pressing space
- TestLogic.fail();
+ TestLogic.fail("difficulty");
return;
}
if (Config.stopOnError == "word") {
@@ -311,7 +311,7 @@ function handleSpace(event, isEnter) {
TestStats.pushKeypressWord(TestLogic.words.currentIndex);
TestStats.updateLastKeypress();
if (Config.difficulty == "expert" || Config.difficulty == "master") {
- TestLogic.fail();
+ TestLogic.fail("difficulty");
return;
} else if (TestLogic.words.currentIndex == TestLogic.words.length) {
//submitted last word that is incorrect
@@ -329,7 +329,7 @@ function handleSpace(event, isEnter) {
(Config.minBurst === "fixed" && burst < Config.minBurstCustomSpeed) ||
(Config.minBurst === "flex" && burst < flex)
) {
- TestLogic.fail();
+ TestLogic.fail("min burst");
return;
}
@@ -684,7 +684,7 @@ function handleAlpha(event) {
}
if (!thisCharCorrect && Config.difficulty == "master") {
- TestLogic.fail();
+ TestLogic.fail("difficulty");
return;
}
diff --git a/src/js/test/test-logic.js b/src/js/test/test-logic.js
index 5f84de7a7..20ce4bd72 100644
--- a/src/js/test/test-logic.js
+++ b/src/js/test/test-logic.js
@@ -1350,7 +1350,7 @@ export function finish(difficultyFailed = false) {
}
if (difficultyFailed) {
- Notifications.add("Test failed", 0, 1);
+ Notifications.add(`Test failed - ${failReason}`, 0, 1);
} else if (afkDetected) {
Notifications.add("Test invalid - AFK detected", 0);
} else if (isRepeated) {
@@ -1831,7 +1831,7 @@ export function finish(difficultyFailed = false) {
// otherText += "
" + Config.layout;
// }
if (difficultyFailed) {
- otherText += "
failed";
+ otherText += `
failed (${failReason})`;
}
if (afkDetected) {
otherText += "
afk detected";
@@ -1949,7 +1949,9 @@ export function finish(difficultyFailed = false) {
);
}
-export function fail() {
+let failReason = "";
+export function fail(reason) {
+ failReason = reason;
input.pushHistory();
corrected.pushHistory();
TestStats.pushKeypressesToHistory();
diff --git a/src/js/test/test-timer.js b/src/js/test/test-timer.js
index bba7a343d..1af1ec5ab 100644
--- a/src/js/test/test-timer.js
+++ b/src/js/test/test-timer.js
@@ -88,15 +88,21 @@ export function start() {
TestStats.pushKeypressesToHistory();
if (
- (Config.minWpm === "custom" &&
- wpmAndRaw.wpm < parseInt(Config.minWpmCustomSpeed) &&
- TestLogic.words.currentIndex > 3) ||
- (Config.minAcc === "custom" &&
- acc < parseInt(Config.minAccCustom) &&
- TestLogic.words.currentIndex > 3)
+ Config.minWpm === "custom" &&
+ wpmAndRaw.wpm < parseInt(Config.minWpmCustomSpeed) &&
+ TestLogic.words.currentIndex > 3
) {
clearTimeout(timer);
- TestLogic.fail();
+ TestLogic.fail("min wpm");
+ return;
+ }
+ if (
+ Config.minAcc === "custom" &&
+ acc < parseInt(Config.minAccCustom) &&
+ TestLogic.words.currentIndex > 3
+ ) {
+ clearTimeout(timer);
+ TestLogic.fail("min accuracy");
return;
}
if (