From 4f0a78022a464becccb676c9edd292ea293056a4 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 17 Jan 2023 11:10:06 +0100 Subject: [PATCH] fix tests --- frontend/src/components/Contributions/ContributionForm.spec.js | 2 ++ frontend/src/components/Contributions/ContributionForm.vue | 2 +- frontend/src/components/Inputs/InputHour.spec.js | 2 +- frontend/src/components/Inputs/InputHour.vue | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index c417ca54c..bc7ed9785 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -12,6 +12,7 @@ describe('ContributionForm', () => { date: '', memo: '', amount: '', + hours: 0, }, isThisMonth: true, minimalDate: new Date(), @@ -375,6 +376,7 @@ describe('ContributionForm', () => { date: now, memo: 'Mein Beitrag zur Gemeinschaft für diesen Monat ...', amount: '200', + hours: 0, }, ]), ]), diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 7e6ca4737..210841b05 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -109,7 +109,7 @@ export default { this.form.id = null this.form.date = '' this.form.memo = '' - this.form.hours = null + this.form.hours = 0 this.form.amount = '' }, }, diff --git a/frontend/src/components/Inputs/InputHour.spec.js b/frontend/src/components/Inputs/InputHour.spec.js index d1eb06c5c..482c64343 100644 --- a/frontend/src/components/Inputs/InputHour.spec.js +++ b/frontend/src/components/Inputs/InputHour.spec.js @@ -74,7 +74,7 @@ describe('InputHour', () => { it('emits input with new value', async () => { await wrapper.find('input').setValue('12') expect(wrapper.emitted('input')).toBeTruthy() - expect(wrapper.emitted('input')).toEqual([['12']]) + expect(wrapper.emitted('input')).toEqual([[12]]) }) }) diff --git a/frontend/src/components/Inputs/InputHour.vue b/frontend/src/components/Inputs/InputHour.vue index 165726d61..9f80cc4f6 100644 --- a/frontend/src/components/Inputs/InputHour.vue +++ b/frontend/src/components/Inputs/InputHour.vue @@ -50,7 +50,7 @@ export default { }, watch: { currentValue() { - this.$emit('input', isNaN(Number(this.currentValue)) ? 0 : Number(this.currentValue)) + this.$emit('input', Number(this.currentValue)) }, value() { if (this.value !== this.currentValue) this.currentValue = this.value