diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index 4f3ee6fa6..0a85c088d 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -45,8 +45,70 @@ describe('ContributionForm', () => { expect(wrapper.find('div.contribution-form').exists()).toBe(true) }) - it('is submit button disable of true', () => { - expect(wrapper.find('button[type="submit"]').attributes('disabled')).toBe('disabled') + describe('empty form data', () => { + describe('has button', () => { + it('reset enabled', () => { + expect(wrapper.find('button[type="reset"]').attributes('disabled')).toBeFalsy() + }) + + it('submit disabled', () => { + expect(wrapper.find('button[type="submit"]').attributes('disabled')).toBe('disabled') + }) + }) + }) + + describe('set contrubtion', () => { + describe('fill in form data', () => { + const now = new Date().toISOString() + + beforeEach(async () => { + await wrapper.setData({ + form: { + id: null, + date: now, + memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', + amount: '200', + }, + }) + }) + + describe('has button', () => { + it('reset enabled', () => { + expect(wrapper.find('button[type="reset"]').attributes('disabled')).toBeFalsy() + }) + + it('submit enabled', () => { + expect(wrapper.find('button[type="submit"]').attributes('disabled')).toBeFalsy() + }) + }) + }) + }) + + describe('update contrubtion', () => { + describe('fill in form data and "id"', () => { + const now = new Date().toISOString() + + beforeEach(async () => { + await wrapper.setData({ + form: { + id: 2, + date: now, + memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', + amount: '200', + }, + }) + }) + + describe('has button', () => { + it('reset enabled', () => { + expect(wrapper.find('button[type="reset"]').attributes('disabled')).toBeFalsy() + }) + + it('submit enabled', () => { + expect(wrapper.find('button[type="submit"]').attributes('disabled')).toBeFalsy() + }) + }) + }) }) }) }) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index f5231c1aa..b18a92a13 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -71,8 +71,8 @@ - - {{ $t('form.reset') }} + + {{ $t('form.cancel') }}