mirror of
https://github.com/langgenius/dify.git
synced 2026-05-09 21:28:25 +08:00
Guard select fields against default leakage
This commit is contained in:
parent
eb2eefdbb5
commit
cae5315c18
@ -444,4 +444,31 @@ describe('InputField', () => {
|
||||
expect(lastVarReferencePickerProps?.filterVar?.({ type: VarType.string })).toBe(false)
|
||||
expect(lastVarReferencePickerProps?.filterVar?.({ type: VarType.arrayFile })).toBe(false)
|
||||
})
|
||||
|
||||
it('should clear paragraph default state when switching to select', async () => {
|
||||
const user = userEvent.setup()
|
||||
const onChange = vi.fn()
|
||||
|
||||
render(
|
||||
<InputField
|
||||
nodeId="node-12"
|
||||
isEdit={false}
|
||||
payload={createPayload({
|
||||
default: {
|
||||
type: 'constant',
|
||||
selector: [],
|
||||
value: 'paragraph-default',
|
||||
},
|
||||
})}
|
||||
onChange={onChange}
|
||||
onCancel={vi.fn()}
|
||||
/>,
|
||||
)
|
||||
|
||||
await user.click(screen.getByRole('button', { name: 'select-select' }))
|
||||
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