From aa52cd3b574eb8fcb7dc66e8d9f3afaf1b7092a1 Mon Sep 17 00:00:00 2001 From: teknium1 <127238744+teknium1@users.noreply.github.com> Date: Fri, 5 Jun 2026 17:46:10 -0700 Subject: [PATCH] test(desktop): unmount between IME composition repro cases The new IME repro test has two it() blocks but the desktop suite registers no global testing-library auto-cleanup, so the first render() leaked its editor into the second test and getByTestId('editor') matched two nodes. Add afterEach(cleanup) so each case renders into a fresh DOM. --- .../app/chat/composer/ime-composition-dom-repro.test.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx b/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx index 94dbd0ed9be..962183ec7d8 100644 --- a/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx +++ b/apps/desktop/src/app/chat/composer/ime-composition-dom-repro.test.tsx @@ -1,6 +1,11 @@ -import { act, fireEvent, render } from '@testing-library/react' +import { act, cleanup, fireEvent, render } from '@testing-library/react' import { useRef, useState } from 'react' -import { describe, expect, it } from 'vitest' +import { afterEach, describe, expect, it } from 'vitest' + +// No global setupFiles registers auto-cleanup, so unmount between tests — +// otherwise a second render() leaks the first editor and getByTestId('editor') +// matches multiple nodes. +afterEach(cleanup) // Faithful mirror of index.tsx's composer text wiring for IME input, driven // through REAL DOM composition + input events on a contentEditable.