From b2eec5980b208612fbf5c2c2f0ac9a5a615cd80e Mon Sep 17 00:00:00 2001 From: Brennan Benson <79079362+brennanb2025@users.noreply.github.com> Date: Sun, 30 Aug 2026 17:35:24 -0700 Subject: [PATCH] fix(native-chat): route app menu image paste in codex chat (#17498) Co-authored-by: Merge Sim --- .../NativeChatStructuredSession.test.tsx | 37 +++++++++++++++++-- .../NativeChatStructuredSession.tsx | 10 ++++- 2 files changed, 41 insertions(+), 6 deletions(-) diff --git a/src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx b/src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx index e0e8b74fe63..bfb3dd1ef52 100644 --- a/src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx +++ b/src/renderer/src/components/native-chat/NativeChatStructuredSession.test.tsx @@ -1,7 +1,7 @@ // @vitest-environment happy-dom import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react' -import type React from 'react' +import React, { forwardRef, useImperativeHandle } from 'react' import { afterEach, describe, expect, it, vi } from 'vitest' const mocks = vi.hoisted(() => ({ @@ -13,6 +13,8 @@ const mocks = vi.hoisted(() => ({ onLinkClick?: (...args: unknown[]) => void }, composerProps: null as null | { structuredTransport?: Record }, + handlePasteEvent: vi.fn(), + pasteFromClipboard: vi.fn(), submissions: [] as unknown[] })) @@ -110,10 +112,16 @@ vi.mock('./NativeChatMessageList', () => ({ })) vi.mock('./NativeChatComposer', () => ({ - NativeChatComposer: (props: typeof mocks.composerProps) => { + NativeChatComposer: forwardRef((props: typeof mocks.composerProps, ref) => { mocks.composerProps = props - return null - } + useImperativeHandle(ref, () => ({ + focus: () => true, + insertTypedText: () => true, + handlePasteEvent: mocks.handlePasteEvent, + pasteFromClipboard: mocks.pasteFromClipboard + })) + return