From fa2c4f3bc3b58ca4e83d29ac386aa6143fe4111b Mon Sep 17 00:00:00 2001 From: ogerly Date: Fri, 16 Dec 2022 09:57:25 +0100 Subject: [PATCH] fix send contribution amount --- frontend/src/components/Contributions/ContributionForm.vue | 4 +--- frontend/src/components/Inputs/InputAmount.vue | 3 ++- frontend/src/pages/Send.spec.js | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Contributions/ContributionForm.vue b/frontend/src/components/Contributions/ContributionForm.vue index 25f03812a..5254baadd 100644 --- a/frontend/src/components/Contributions/ContributionForm.vue +++ b/frontend/src/components/Contributions/ContributionForm.vue @@ -130,8 +130,6 @@ import InputTime from '@/components/Inputs/InputTime.vue' import InputAmount from '@/components/Inputs/InputAmount.vue' import InputTextarea from '@/components/Inputs/InputTextarea.vue' -const PATTERN_NON_DIGIT = /\D/g - export default { name: 'ContributionForm', components: { @@ -162,7 +160,7 @@ export default { // return value.replace(PATTERN_NON_DIGIT, '') // }, submit() { - this.form.amount = this.form.amount.replace(PATTERN_NON_DIGIT, '') + // this.form.amount = this.form.amount.replace(PATTERN_NON_DIGIT, '') // spreading is needed for testing this.$emit(this.form.id ? 'update-contribution' : 'set-contribution', { ...this.form }) this.reset() diff --git a/frontend/src/components/Inputs/InputAmount.vue b/frontend/src/components/Inputs/InputAmount.vue index 38a6a02db..7884b7161 100644 --- a/frontend/src/components/Inputs/InputAmount.vue +++ b/frontend/src/components/Inputs/InputAmount.vue @@ -88,7 +88,8 @@ export default { this.currentValue = this.$n(this.amountValue, 'ungroupedDecimal') } if (this.typ === 'ContributionForm') { - this.currentValue = this.amountValue.toFixed() + // this.currentValue = this.amountValue + this.currentValue = this.$n(this.amountValue, 'ungroupedDecimal') } }, }, diff --git a/frontend/src/pages/Send.spec.js b/frontend/src/pages/Send.spec.js index fab3af77b..4ea8773e8 100644 --- a/frontend/src/pages/Send.spec.js +++ b/frontend/src/pages/Send.spec.js @@ -88,7 +88,7 @@ describe('Send', () => { it('restores the previous data in the formular', () => { expect(wrapper.find("input[type='email']").vm.$el.value).toBe('user@example.org') - expect(wrapper.find("input[type='email']").vm.$el.value).toBe('23.45') + expect(wrapper.find("input[type='text']").vm.$el.value).toBe('23.45') expect(wrapper.find('textarea').vm.$el.value).toBe('Make the best of it!') }) })