diff --git a/src/components/image-editor/ImageCanvasSpecGenerationPanelView.test.tsx b/src/components/image-editor/ImageCanvasSpecGenerationPanelView.test.tsx index 1f490f9bb..c9a7b22f8 100644 --- a/src/components/image-editor/ImageCanvasSpecGenerationPanelView.test.tsx +++ b/src/components/image-editor/ImageCanvasSpecGenerationPanelView.test.tsx @@ -106,6 +106,30 @@ function UiDesignHarness({ ) : null; } +function CharacterSpecReferenceMenuHarness({ + onRequestUpload = vi.fn(), +}: { + onRequestUpload?: (target: UploadTarget) => void; +}) { + const [isMenuOpen, setIsMenuOpen] = useState(false); + const referenceButtonRef = createRef(); + return ( + node} + buildPortalMenuStyle={() => ({ position: 'fixed', left: 0, top: 0 })} + onUpdateSpecFormValue={vi.fn()} + onRequestUpload={onRequestUpload} + onSubmit={vi.fn()} + /> + ); +} + function IconSpecHarness({ playSetting = '回合制占点', artStyle = '低多边形', @@ -314,6 +338,17 @@ describe('ImageCanvasSpecGenerationPanelView', () => { ); }); + it('keeps the character spec reference source menu open after clicking the add slot', () => { + render(); + + const addButton = screen.getByRole('button', { name: '参考图' }); + fireEvent.click(addButton); + expect(screen.getByRole('menu', { name: '参考图来源' })).toBeTruthy(); + + fireEvent.click(addButton); + expect(screen.queryByRole('menu', { name: '参考图来源' })).toBeNull(); + }); + it('uses gameplay and art style hints for icon specs', () => { renderPanel({ dialog: createSpecDialog({ diff --git a/src/components/image-editor/ImageCanvasSpecGenerationPanelView.tsx b/src/components/image-editor/ImageCanvasSpecGenerationPanelView.tsx index a06c11152..7042ea44b 100644 --- a/src/components/image-editor/ImageCanvasSpecGenerationPanelView.tsx +++ b/src/components/image-editor/ImageCanvasSpecGenerationPanelView.tsx @@ -385,6 +385,7 @@ export function ImageCanvasSpecGenerationPanelView({ ))} {!isUiDesignDialog && dialog.specType !== 'icon' ? (