fix send contribution amount

This commit is contained in:
ogerly 2022-12-16 09:57:25 +01:00
parent 4615eb4fe6
commit fa2c4f3bc3
3 changed files with 4 additions and 5 deletions

View File

@ -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()

View File

@ -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')
}
},
},

View File

@ -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!')
})
})