Skip to content

Commit

Permalink
💚 [#52] Update tests after behaviour change
Browse files Browse the repository at this point in the history
Setting the data source to 'manual' now populates the values
with a single empty option.
  • Loading branch information
sergei-maertens committed Nov 17, 2023
1 parent a7d7d0a commit 7c6573a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/builder/values/values-config.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ export const SelectBoxesResetState: StoryObj<{
await userEvent.click(await canvas.findByText('Manually fill in'));
const addBtn = await canvas.findByRole('button', {name: 'Add another'});
await expect(addBtn).toBeVisible();
await userEvent.click(addBtn);

await doSubmit();
await expect(args.onSubmit).toHaveBeenCalledWith({
Expand Down Expand Up @@ -183,7 +182,8 @@ export const SelectBoxesResetState: StoryObj<{
await doSubmit();
await expect(args.onSubmit).toHaveBeenCalledWith({
openForms: {dataSrc: 'manual'},
values: [], // all pre-existing items have been cleared
// all pre-existing items have been cleared and we ensure there's at least 1 item
values: [{value: '', label: '', openForms: {translations: {}}}],
});
// @ts-expect-error jest mocks + TS doesn't play nice together
args.onSubmit.mockClear();
Expand Down

0 comments on commit 7c6573a

Please sign in to comment.