mirror of
https://github.com/langgenius/dify.git
synced 2026-05-10 05:56:31 +08:00
Cover file type transitions in human input tests
This commit is contained in:
parent
1b45cdb08a
commit
4f63b2b162
@ -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(
|
||||
<InputField
|
||||
nodeId="node-13-1"
|
||||
isEdit={false}
|
||||
payload={createPayload({
|
||||
default: {
|
||||
type: 'constant',
|
||||
selector: [],
|
||||
value: 'paragraph-default',
|
||||
},
|
||||
})}
|
||||
onChange={onChange}
|
||||
onCancel={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
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(
|
||||
<InputField
|
||||
nodeId="node-14-1"
|
||||
isEdit={false}
|
||||
payload={createPayload({
|
||||
default: {
|
||||
type: 'constant',
|
||||
selector: [],
|
||||
value: 'paragraph-default',
|
||||
},
|
||||
})}
|
||||
onChange={onChange}
|
||||
onCancel={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
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')
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user