Skip to content

Commit

Permalink
fix(indicate typos): undefined hints in stop on letter (#5281)
Browse files Browse the repository at this point in the history
  • Loading branch information
NadAlaba committed Apr 5, 2024
1 parent aeaedd2 commit 2dbd7af
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions frontend/src/ts/test/test-ui.ts
Expand Up @@ -35,15 +35,16 @@ async function gethtml2canvas(): Promise<typeof import("html2canvas").default> {

function createHintsHtml(
incorrectLtrIndices: number[][],
activeWordLetters: NodeListOf<Element>
activeWordLetters: NodeListOf<Element>,
inputWord: string
): string {
let hintsHtml = "";
for (const adjacentLetters of incorrectLtrIndices) {
for (const indx of adjacentLetters) {
const blockLeft = (activeWordLetters[indx] as HTMLElement).offsetLeft;
const blockWidth = (activeWordLetters[indx] as HTMLElement).offsetWidth;
const blockIndices = `[${indx}]`;
const blockChars = TestInput.input.current[indx];
const blockChars = inputWord[indx];

hintsHtml +=
`<hint data-length=1 data-chars-index=${blockIndices}` +
Expand Down Expand Up @@ -886,7 +887,7 @@ export async function updateWordElement(

if (hintIndices?.length) {
const activeWordLetters = wordAtIndex.querySelectorAll("letter");
const hintsHtml = createHintsHtml(hintIndices, activeWordLetters);
const hintsHtml = createHintsHtml(hintIndices, activeWordLetters, input);
wordAtIndex.insertAdjacentHTML("beforeend", hintsHtml);
const hintElements = wordAtIndex.getElementsByTagName("hint");
await joinOverlappingHints(hintIndices, activeWordLetters, hintElements);
Expand Down

0 comments on commit 2dbd7af

Please sign in to comment.