diff --git a/tests/list.test.tsx b/tests/list.test.tsx index 8a207e240..8c312d313 100644 --- a/tests/list.test.tsx +++ b/tests/list.test.tsx @@ -1139,4 +1139,36 @@ describe('Form.List', () => { { list: [{ name: 'John', tags: ['react', 'ts', 'redux'] }] }, ); }); + + it('should not drop list items when updating list item field', async () => { + const onValuesChange = jest.fn(); + + const { getAllByRole } = render( +
+ + {fields => + fields.map(field => ( + + + + )) + } + +
, + ); + + // Change second item (index = 1) + fireEvent.change(getAllByRole('textbox')[1], { + target: { value: 'BB' }, + }); + + const [, allValues] = onValuesChange.mock.calls.pop(); + + expect(allValues).toEqual({ + list: [{ name: 'A' }, { name: 'BB' }, { name: 'C' }, { name: 'D' }], + }); + }); });