Skip to content
TypeScript

test(web): chat shortcut test types through the composer handle (#23126)

Julius Marmingebd6940beab9e
diff --git a/apps/web/src/components/chat/useChatShortcuts.browser.test.tsx b/apps/web/src/components/chat/useChatShortcuts.browser.test.tsx
index e0163288e44..b601de299da 100644
--- a/apps/web/src/components/chat/useChatShortcuts.browser.test.tsx
+++ b/apps/web/src/components/chat/useChatShortcuts.browser.test.tsx
@@ -3,6 +3,7 @@ import { expect, it } from "vite-plus/test";
import { userEvent } from "vite-plus/test/browser";
import { render } from "../../../test/render";
+import type { ChatComposerHandle } from "./ChatComposer";
import { useChatShortcuts } from "./useChatShortcuts";
const shortcutContext = {
@@ -50,10 +51,16 @@ function Chat(props: { composerKeys: string[]; launcher?: { keys: string; receiv
scriptKeybindings: [],
getShortcutContext: () => shortcutContext,
threadFindActive: false,
- typeIntoComposer: (key) => {
- props.composerKeys.push(key);
- return true;
+ // Type-to-focus only calls insertTextAtEnd, so the stand-in composer implements just that.
+ composerRef: {
+ current: {
+ insertTextAtEnd: (key: string) => {
+ props.composerKeys.push(key);
+ return true;
+ },
+ } as Partial<ChatComposerHandle> as ChatComposerHandle,
},
+ branchToolbarRef: { current: null },
closeThreadFind: () => {},
commands: {},
fallback: () => undefined,