Skip to content

Commit

Permalink
fix(result word history): incorrect words not being underlined
Browse files Browse the repository at this point in the history
  • Loading branch information
Miodec committed Oct 23, 2024
1 parent c75c6d8 commit 6186257
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/src/ts/test/test-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1148,19 +1148,23 @@ async function loadWordsHistory(): Promise<boolean> {
) !== null;
let wordEl = "";
try {
if (input === undefined || input === "")
if (input === undefined || input === "") {
throw new Error("empty input word");
}

const errorClass = input !== word ? "error" : "";

if (corrected !== undefined && corrected !== "") {
const correctedChar = !containsKorean
? corrected
: Hangul.assemble(corrected.split(""));
wordEl = `<div class='word nocursor' burst="${
wordEl = `<div class='word nocursor ${errorClass}' burst="${
TestInput.burstHistory[i]
}" input="${correctedChar
.replace(/"/g, "&quot;")
.replace(/ /g, "_")}">`;
} else {
wordEl = `<div class='word nocursor' burst="${
wordEl = `<div class='word nocursor ${errorClass}' burst="${
TestInput.burstHistory[i]
}" input="${input.replace(/"/g, "&quot;").replace(/ /g, "_")}">`;
}
Expand Down

0 comments on commit 6186257

Please sign in to comment.