chore: add guards to before delete

This commit is contained in:
Miodec 2025-11-28 21:36:49 +01:00
parent 2886c72833
commit 34e971bc42

View file

@ -4,12 +4,23 @@ import * as TestState from "../../test/test-state";
import * as TestWords from "../../test/test-words";
import { getInputElementValue } from "../input-element";
import * as TestUI from "../../test/test-ui";
import { isAwaitingNextWord } from "../state";
export function onBeforeDelete(event: InputEvent): void {
if (!TestState.isActive) {
event.preventDefault();
return;
}
if (TestState.testRestarting) {
return;
}
if (isAwaitingNextWord()) {
return;
}
if (TestUI.resultCalculating) {
return;
}
const { inputValue } = getInputElementValue();
const inputIsEmpty = inputValue === "";