fix(design): restore streamed replies and quote handoff
This commit is contained in:
1 parent
229b1b1ce3
commit
23f96a523e
9 files changed
+362
-19
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { cleanup, fireEvent, render, screen, within } from '@testing-library/react';
|
||||
import { cleanup, fireEvent, render, screen, waitFor, within } from '@testing-library/react';
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { YouthCreationCard } from '@/pages/ImageCanvas/YouthCreationCard';
|
||||
import { DesignTaskPanel } from '@/pages/ImageCanvas/DesignProductionPanel';
|
||||
@@ -21,12 +21,14 @@ function renderCard(
|
||||
quoteBlockers?: DesignCompilationIssue[];
|
||||
onOpenFineTune?: () => void;
|
||||
onFocusComposer?: () => void;
|
||||
onQuoteOffered?: () => void;
|
||||
} = {},
|
||||
) {
|
||||
const requestQuote = vi.fn().mockResolvedValue(workspace);
|
||||
const resolveDecisionPrompt = vi.fn().mockResolvedValue(workspace);
|
||||
const onOpenFineTune = options.onOpenFineTune ?? vi.fn();
|
||||
const onFocusComposer = options.onFocusComposer ?? vi.fn();
|
||||
const onQuoteOffered = options.onQuoteOffered ?? vi.fn();
|
||||
useImageWorkspaceStore.setState({
|
||||
workspace,
|
||||
quoteBlockers: [],
|
||||
@@ -41,6 +43,7 @@ function renderCard(
|
||||
generationAvailable={options.generationAvailable ?? true}
|
||||
onOpenFineTune={onOpenFineTune}
|
||||
onFocusComposer={onFocusComposer}
|
||||
onQuoteOffered={onQuoteOffered}
|
||||
/>,
|
||||
);
|
||||
return {
|
||||
@@ -49,6 +52,7 @@ function renderCard(
|
||||
resolveDecisionPrompt,
|
||||
onOpenFineTune,
|
||||
onFocusComposer,
|
||||
onQuoteOffered,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -97,8 +101,8 @@ describe('YouthCreationCard', () => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('shows a plain creation summary and offers a youth-facing ready action', () => {
|
||||
const { requestQuote } = renderCard();
|
||||
it('shows a plain creation summary and reveals the offered quote after requesting it', async () => {
|
||||
const { onQuoteOffered, requestQuote } = renderCard();
|
||||
|
||||
expect(screen.getByRole('heading', { name: 'AI 听懂的想法' })).toBeInTheDocument();
|
||||
expect(screen.getByText('会跟着聊天自动更新,不需要逐项填写。')).toBeInTheDocument();
|
||||
@@ -112,6 +116,7 @@ describe('YouthCreationCard', () => {
|
||||
fireEvent.click(screen.getByRole('button', { name: '看看制作方案' }));
|
||||
|
||||
expect(requestQuote).toHaveBeenCalledOnce();
|
||||
await waitFor(() => expect(onQuoteOffered).toHaveBeenCalledOnce());
|
||||
});
|
||||
|
||||
it('does not surface legacy decision prompts as a form', () => {
|
||||
|
||||
Reference in new issue
Block a user