Merge branch 'master' into 1703-submit-button-disabled-when-total-amount-to-submit-is-minus

This commit is contained in:
Alexander Friedland 2022-03-31 23:14:33 +02:00 committed by GitHub
commit 8f81f922b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 5 deletions

View File

@ -45,6 +45,33 @@ describe('GddSend confirm', () => {
it('renders the component div.confirm-box-send', () => {
expect(wrapper.find('div.confirm-box-send').exists()).toBeTruthy()
})
describe('send now button', () => {
beforeEach(() => {
jest.clearAllMocks()
})
describe('single click', () => {
beforeEach(async () => {
await wrapper.find('button.btn-success').trigger('click')
})
it('emits send transaction one time', () => {
expect(wrapper.emitted('send-transaction')).toHaveLength(1)
})
})
describe('double click', () => {
beforeEach(async () => {
await wrapper.find('button.btn-success').trigger('click')
await wrapper.find('button.btn-success').trigger('click')
})
it('emits send transaction one time', () => {
expect(wrapper.emitted('send-transaction')).toHaveLength(1)
})
})
})
})
})
})

View File

@ -58,7 +58,11 @@
<b-button @click="$emit('on-reset')">{{ $t('form.cancel') }}</b-button>
</b-col>
<b-col class="text-right">
<b-button variant="success" :disabled="loading" @click="$emit('send-transaction')">
<b-button
variant="success"
:disabled="disabled"
@click="$emit('send-transaction'), (disabled = true)"
>
{{ $t('form.send_now') }}
</b-button>
</b-col>
@ -73,8 +77,11 @@ export default {
email: { type: String, required: false, default: '' },
amount: { type: Number, required: true },
memo: { type: String, required: true },
loading: { type: Boolean, required: true },
selected: { type: String, required: true },
},
data() {
return {
disabled: false,
}
},
}
</script>

View File

@ -12,11 +12,9 @@
<template #transactionConfirmationSend>
<transaction-confirmation-send
:balance="balance"
:selected="transactionData.selected"
:email="transactionData.email"
:amount="transactionData.amount"
:memo="transactionData.memo"
:loading="loading"
@send-transaction="sendTransaction"
@on-reset="onReset"
></transaction-confirmation-send>