reset transaction formular emits set transaction with empty data

This commit is contained in:
Moriz Wahl 2022-03-22 18:25:58 +01:00
parent 9097a45cff
commit 421ae60507
2 changed files with 17 additions and 1 deletions

View File

@ -200,7 +200,7 @@ describe('GddSend', () => {
expect(wrapper.find('button[type="reset"]').text()).toBe('form.reset')
})
it('clears all fields on click', async () => {
it('clears all fields on click and emits set-transaction', async () => {
await wrapper.find('#input-group-1').find('input').setValue('someone@watches.tv')
await wrapper.find('#input-group-2').find('input').setValue('87.23')
await wrapper.find('#input-group-3').find('textarea').setValue('Long enough')
@ -213,6 +213,16 @@ describe('GddSend', () => {
expect(wrapper.vm.form.email).toBe('')
expect(wrapper.vm.form.amount).toBe('')
expect(wrapper.vm.form.memo).toBe('')
expect(wrapper.emitted('set-transaction')).toEqual([
[
{
selected: 'send',
email: '',
amount: 0,
memo: '',
},
],
])
})
})

View File

@ -192,6 +192,12 @@ export default {
this.form.email = ''
this.form.amount = ''
this.form.memo = ''
this.$emit('set-transaction', {
selected: this.selected,
email: '',
amount: 0,
memo: '',
})
},
normalizeAmount(isValid) {
this.amountFocused = false