Skip to content

Commit a00a8bb

Browse files
committed
fix: changing tape mode during the test causing overflow
1 parent d2caf24 commit a00a8bb

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ function getWordHTML(word: string): string {
347347
return retval;
348348
}
349349

350-
function updateWordWrapperClasses(): void {
350+
function updateWordWrapperClasses(initial = false): void {
351351
if (Config.tapeMode !== "off") {
352352
$("#words").addClass("tape");
353353
$("#wordsWrapper").addClass("tape");
@@ -382,13 +382,15 @@ function updateWordWrapperClasses(): void {
382382
}
383383

384384
$("#words").attr("class", existing.join(" "));
385+
386+
updateWordsWidth();
387+
updateWordsHeight(true);
388+
void updateWordsInputPosition(initial);
385389
}
386390

387391
export function showWords(): void {
388392
$("#words").empty();
389393

390-
updateWordWrapperClasses();
391-
392394
let wordsHTML = "";
393395
if (Config.mode !== "zen") {
394396
for (let i = 0; i < TestWords.words.length; i++) {
@@ -401,13 +403,12 @@ export function showWords(): void {
401403

402404
$("#words").html(wordsHTML);
403405

404-
updateWordsWidth();
405-
updateWordsHeight(true);
406406
updateActiveElement(undefined, true);
407407
setTimeout(() => {
408408
void Caret.updatePosition();
409409
}, 125);
410-
void updateWordsInputPosition(true);
410+
411+
updateWordWrapperClasses(true);
411412
}
412413

413414
const posUpdateLangList = ["japanese", "chinese", "korean"];

0 commit comments

Comments
 (0)