The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 04:30 UTC
test(web): file editor dismissal test waits for the editor to render (#30350)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Nov 3, 2026 at 15:31 UTC
fcad9de8cee5ec3e8486dc05eb2b662ab0c3e7c9
1 file changed
+6
-6
apps/web/src/components/files/fileEditorDismissal.browser.test.tsx
+6
-6
@@ -1,3 +1,4 @@
1
+import { DEFAULT_THEMES, preloadHighlighter } from "@pierre/diffs";
2
import { Editor, type EditorFactory } from "@pierre/diffs/edit";
3
import { EditProvider, File } from "@pierre/diffs/react";
4
import { describe, expect, it, vi } from "vite-plus/test";
@@ -12,6 +13,8 @@ describe("installFileEditorDismissal", () => {
13
let editor: Editor<"file" | "file-diff", undefined, undefined> | undefined;
14
const createEditor: EditorFactory<undefined, undefined> = (...args) =>
15
(editor = new Editor(...args));
16
+ // File paints nothing until the shared highlighter has loaded; once it has, mount renders synchronously.
17
+ await preloadHighlighter({ themes: Object.values(DEFAULT_THEMES), langs: ["typescript"] });
18
await using screen = await render(
19
<>
20
<p>Assistant reply</p>
@@ -23,17 +26,14 @@ describe("installFileEditorDismissal", () => {
26
</>,
27
);
28
const shadowRoot = () => screen.container.querySelector("diffs-container")?.shadowRoot;
26
- const content = await vi.waitFor(() => {
27
- const element = shadowRoot()?.querySelector<HTMLElement>("[data-content]");
28
- expect(element).toBeTruthy();
29
- return element!;
30
- });
29
+ const content = shadowRoot()?.querySelector<HTMLElement>("[data-content]");
30
+ expect(content).toBeTruthy();
31
32
editor!.setSelections([
33
{ start: { line: 0, character: 8 }, end: { line: 0, character: 8 }, direction: "none" },
34
]);
35
const isMac = isMacPlatform(navigator.platform);
36
- content.dispatchEvent(
36
+ content!.dispatchEvent(
37
new KeyboardEvent("keydown", {
38
key: "f",
39
code: "KeyF",