Skip to content

Commit

Permalink
test(form): add initial values test (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdieLemoine authored Nov 21, 2023
1 parent be3bdd5 commit 434cdf1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions libs/core/src/__tests__/form/field.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,4 +173,18 @@ describe('Form fields', () => {

expect(form.isValid.value).toBe(true);
});

it('gets filled with initial data from form config', async () => {
expect.assertions(1);

const field = defineField({
component: 'input',
name: 'element',
ref: ref('disregarded'),
});

const form = generateForm({fields: [field], initialValues: {element: 'hello'}});

expect(form.model.element.ref.value).toBe('hello');
});
});

0 comments on commit 434cdf1

Please sign in to comment.