diff options
Diffstat (limited to 'spec/frontend/crm/contact_form_wrapper_spec.js')
-rw-r--r-- | spec/frontend/crm/contact_form_wrapper_spec.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/spec/frontend/crm/contact_form_wrapper_spec.js b/spec/frontend/crm/contact_form_wrapper_spec.js index 5e1743701e4..e49b553e4b5 100644 --- a/spec/frontend/crm/contact_form_wrapper_spec.js +++ b/spec/frontend/crm/contact_form_wrapper_spec.js @@ -56,8 +56,9 @@ describe('Customer relations contact form wrapper', () => { ${'edit'} | ${'Edit contact'} | ${'Contact has been updated.'} | ${updateContactMutation} | ${contacts[0].id} ${'create'} | ${'New contact'} | ${'Contact has been added.'} | ${createContactMutation} | ${null} `('in $mode mode', ({ mode, title, successMessage, mutation, existingId }) => { + const isEditMode = mode === 'edit'; + beforeEach(() => { - const isEditMode = mode === 'edit'; mountComponent({ isEditMode }); return waitForPromises(); @@ -82,7 +83,7 @@ describe('Customer relations contact form wrapper', () => { }); it('renders correct fields prop', () => { - expect(findContactForm().props('fields')).toEqual([ + const fields = [ { name: 'firstName', label: 'First name', required: true }, { name: 'lastName', label: 'Last name', required: true }, { name: 'email', label: 'Email', required: true }, @@ -98,7 +99,9 @@ describe('Customer relations contact form wrapper', () => { ], }, { name: 'description', label: 'Description' }, - ]); + ]; + if (isEditMode) fields.push({ name: 'active', label: 'Active', required: true, bool: true }); + expect(findContactForm().props('fields')).toEqual(fields); }); it('renders correct title prop', () => { |