Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
LunaTK committed Nov 7, 2023
1 parent ea03363 commit 12c610e
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/core/src/AutoForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,18 @@ describe('AutoForm', () => {
await vi.waitFor(() => handleSubmit.mock.calls.length > 0);
expect(handleSubmit.mock.calls.length).toBe(1);
});

it('Add map item', async () => {
const handleSubmit = vi.fn();
const dom = render(<MockApp onSubmit={handleSubmit}><button id="submit" /></MockApp>);
const submitButton = dom.container.querySelector('#submit');
const addButton = dom.queryAllByText('Add')[0];
expect(submitButton).toBeDefined();
expect(addButton).toBeDefined();

fireEvent.click(addButton!);
fireEvent.click(submitButton!);
await vi.waitFor(() => handleSubmit.mock.calls.length > 0);
expect(handleSubmit.mock.calls.length).toBe(1);
})
})

0 comments on commit 12c610e

Please sign in to comment.