@devries-cameron20 / t3code-1 / commits / 95f164d083
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

test(web): Mod+E bold-word test no longer drops its first arrow key (#35646)

Julius Marminge committed Nov 12, 2026 at 14:48 UTC 95f164d083df6d23e9b00adab4f7a26a31ea7c41
1 file changed +11 -5
apps/web/src/components/ComposerPromptEditorTiptap.input.browser.test.tsx
+11 -5
@@ -195,11 +195,17 @@ it.each([
195 await using screen = await mountEditor("ship it **now** done");
196 const { editor } = screen;
197 const mod = isMacPlatform(navigator.platform) ? "Meta" : "Control";
198 - await act(async () => {
199 - if (typeof caret === "number") editor.commands.focus(caret);
200 - else editor.commands.focus("end");
201 - });
202 - await vi.waitFor(() => expect(document.activeElement).toBe(editor.view.dom));
198 + // ProseMirror rewrites the DOM caret 20ms after focus. Run that now, or it
199 + // can undo the first arrow key before ProseMirror reads the native move.
200 + {
201 + using _timers = fakeTimers();
202 + await act(async () => {
203 + if (typeof caret === "number") editor.commands.focus(caret);
204 + else editor.commands.focus("end");
205 + });
206 + await vi.waitFor(() => expect(document.activeElement).toBe(editor.view.dom));
207 + vi.runOnlyPendingTimers();
208 + }
209 if (typeof caret === "string") await userEvent.keyboard(caret);
210 await userEvent.keyboard(`{${mod}>}${key}{/${mod}}`);
211 await userEvent.keyboard("X");