Skip to content

Commit 6186257

Browse files
committed
fix(result word history): incorrect words not being underlined
1 parent c75c6d8 commit 6186257

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

frontend/src/ts/test/test-ui.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1148,19 +1148,23 @@ async function loadWordsHistory(): Promise<boolean> {
11481148
) !== null;
11491149
let wordEl = "";
11501150
try {
1151-
if (input === undefined || input === "")
1151+
if (input === undefined || input === "") {
11521152
throw new Error("empty input word");
1153+
}
1154+
1155+
const errorClass = input !== word ? "error" : "";
1156+
11531157
if (corrected !== undefined && corrected !== "") {
11541158
const correctedChar = !containsKorean
11551159
? corrected
11561160
: Hangul.assemble(corrected.split(""));
1157-
wordEl = `<div class='word nocursor' burst="${
1161+
wordEl = `<div class='word nocursor ${errorClass}' burst="${
11581162
TestInput.burstHistory[i]
11591163
}" input="${correctedChar
11601164
.replace(/"/g, "&quot;")
11611165
.replace(/ /g, "_")}">`;
11621166
} else {
1163-
wordEl = `<div class='word nocursor' burst="${
1167+
wordEl = `<div class='word nocursor ${errorClass}' burst="${
11641168
TestInput.burstHistory[i]
11651169
}" input="${input.replace(/"/g, "&quot;").replace(/ /g, "_")}">`;
11661170
}

0 commit comments

Comments
 (0)