|
1 | 1 | import { EnvironmentId, MessageId, ThreadId } from "@t3tools/contracts"; |
2 | 2 | import { serializeAssistantCitation } from "@t3tools/shared/assistantCitations"; |
3 | 3 | import * as DateTime from "effect/DateTime"; |
4 | | -import type { ComponentProps } from "react"; |
| 4 | +import { createRef, type ComponentProps } from "react"; |
5 | 5 | import { expect, it, vi } from "vite-plus/test"; |
6 | 6 | import { page } from "vite-plus/test/browser"; |
7 | 7 |
|
@@ -42,7 +42,7 @@ vi.mock(import("../../assets/assetUrls"), async (importOriginal) => ({ |
42 | 42 |
|
43 | 43 | import "~/index.css"; |
44 | 44 | import { render as renderUi } from "../../../test/render"; |
45 | | -import { QueuedRunsControl } from "./QueuedRunsControl"; |
| 45 | +import { QueuedRunsControl, type QueuedRunsControlHandle } from "./QueuedRunsControl"; |
46 | 46 |
|
47 | 47 | function setup() { |
48 | 48 | state.projection = null; |
@@ -203,3 +203,25 @@ it("stays inside the timeline scroller instead of growing the chat column", asyn |
203 | 203 | const column = screen.getByTestId("column").element(); |
204 | 204 | expect(column.scrollHeight).toBe(column.clientHeight); |
205 | 205 | }); |
| 206 | + |
| 207 | +it("does not send a queued message from the shortcut while it is open in the composer", async () => { |
| 208 | + setup(); |
| 209 | + state.projection = { projection: { messages: [] } }; |
| 210 | + state.workflow = { |
| 211 | + activeRun: { id: "run:active" }, |
| 212 | + canPromoteToSteer: true, |
| 213 | + queuedRuns: [ |
| 214 | + { |
| 215 | + run: { id: "run:edited", userMessageId: "message:edited" }, |
| 216 | + text: "Edited", |
| 217 | + attachments: [], |
| 218 | + }, |
| 219 | + ], |
| 220 | + }; |
| 221 | + const ref = createRef<QueuedRunsControlHandle>(); |
| 222 | + await using screen = await renderQueue({ ref, editingRunId: "run:edited" as never }); |
| 223 | + expect(ref.current?.steerNext(true)).toBe(false); |
| 224 | + |
| 225 | + await screen.rerender(<QueuedRunsControl {...baseProps} ref={ref} />); |
| 226 | + expect(ref.current?.steerNext(true)).toBe(true); |
| 227 | +}); |
0 commit comments