From 5fd8ea2223f6f2e2739834ef39fde091ec955682 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 25 Jul 2022 14:06:10 +0200 Subject: [PATCH] Reset amount in Contribution form and write a test --- .../src/components/Contributions/ContributionForm.vue | 1 + frontend/src/pages/Community.spec.js | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 6b8ef39d0..72576ece8 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -111,6 +111,7 @@ export default { this.form.date = '' this.id = null this.form.memo = '' + this.form.amount = '0' }, }, computed: { diff --git a/frontend/src/pages/Community.spec.js b/frontend/src/pages/Community.spec.js index d834ddac1..bce29452c 100644 --- a/frontend/src/pages/Community.spec.js +++ b/frontend/src/pages/Community.spec.js @@ -190,6 +190,13 @@ describe('Community', () => { fetchPolicy: 'network-only', }) }) + + it('set all data to the default values)', () => { + expect(wrapper.vm.form.id).toBe(null) + expect(wrapper.vm.form.date).toBe('') + expect(wrapper.vm.form.memo).toBe('') + expect(wrapper.vm.form.amount).toBe('0') + }) }) describe('with error', () => { @@ -376,7 +383,7 @@ describe('Community', () => { }) }) - it('sets the form date to the new values', () => { + it('sets the form data to the new values', () => { expect(wrapper.vm.form.id).toBe(2) expect(wrapper.vm.form.date).toBe(now) expect(wrapper.vm.form.memo).toBe('Mein Beitrag zur Gemeinschaft für diesen Monat ...')