Skip to content

Commit 1a13127

Browse files
t3dotggclaude
andauthored
test(web): Arabic arrow-key test no longer drops its first key press (#25145)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent f898557 commit 1a13127

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎apps/web/src/components/ComposerPromptEditorTiptap.input.browser.test.tsx‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { createElement, createRef, useEffect, useState } from "react";
1313
import { describe, expect, it, vi } from "vite-plus/test";
1414
import { userEvent } from "vite-plus/test/browser";
1515

16-
import { act, render } from "../../test/render";
16+
import { act, fakeTimers, render } from "../../test/render";
1717

1818
import { serializeEditorDoc } from "~/composer-rich-text-doc";
1919
import { isMacPlatform } from "~/lib/utils";
@@ -376,10 +376,14 @@ describe("composer context undo lifetime", () => {
376376

377377
describe("an Arabic line", () => {
378378
async function focusEnd(editor: Editor) {
379+
// ProseMirror rewrites the DOM caret 20ms after focus. Run that now, or it
380+
// can undo the first arrow key before ProseMirror reads the native move.
381+
using _timers = fakeTimers();
379382
await act(async () => {
380383
editor.commands.focus("end");
381384
});
382385
await vi.waitFor(() => expect(document.activeElement).toBe(editor.view.dom));
386+
vi.runOnlyPendingTimers();
383387
}
384388

385389
it("leaves inline code through its start with ArrowRight, which points back", async () => {

0 commit comments

Comments
 (0)