From 4f63b2b1620e190e297f4a8ae73953392b135e0f Mon Sep 17 00:00:00 2001 From: JzoNg Date: Wed, 22 Apr 2026 08:39:41 +0800 Subject: [PATCH] Cover file type transitions in human input tests --- .../__tests__/input-field.spec.tsx | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx index 6249e3aee9..f1895f8e29 100644 --- a/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx +++ b/web/app/components/base/prompt-editor/plugins/hitl-input-block/__tests__/input-field.spec.tsx @@ -523,6 +523,33 @@ describe('InputField', () => { }) }) + it('should clear paragraph default state when switching to single file', async () => { + const user = userEvent.setup() + const onChange = vi.fn() + + render( + , + ) + + await user.click(screen.getByRole('button', { name: 'select-file' })) + await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i })) + + expect(onChange).toHaveBeenCalledTimes(1) + expect(onChange.mock.calls[0]![0]).not.toHaveProperty('default') + }) + it('should save file-list upload settings and max upload count', async () => { const user = userEvent.setup() const onChange = vi.fn() @@ -551,4 +578,31 @@ describe('InputField', () => { max_upload_count: 4, }) }) + + it('should clear paragraph default state when switching to file-list', async () => { + const user = userEvent.setup() + const onChange = vi.fn() + + render( + , + ) + + await user.click(screen.getByRole('button', { name: 'select-file-list' })) + await user.click(screen.getByRole('button', { name: /workflow\.nodes\.humanInput\.insertInputField\.insert/i })) + + expect(onChange).toHaveBeenCalledTimes(1) + expect(onChange.mock.calls[0]![0]).not.toHaveProperty('default') + }) })