Merge branch 'master' into 1389-TransactionsTabs-are-not-well-designed

This commit is contained in:
Alexander Friedland 2022-02-05 00:07:30 +01:00 committed by GitHub
commit ff00e5e9ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 52 additions and 2 deletions

View File

@ -69,6 +69,7 @@
"memo": "Nachricht",
"message": "Nachricht",
"new_balance": "Neuer Kontostand nach Bestätigung",
"no_gdd_available": "Du hast keine GDD zum versenden.",
"password": "Passwort",
"passwordRepeat": "Passwort wiederholen",
"password_new": "Neues Passwort",

View File

@ -69,6 +69,7 @@
"memo": "Message",
"message": "Message",
"new_balance": "Account balance after confirmation",
"no_gdd_available": "You do not have GDD to send.",
"password": "Password",
"passwordRepeat": "Repeat password",
"password_new": "New password",

View File

@ -21,7 +21,7 @@ describe('GddSend', () => {
}
const propsData = {
balance: 100.0,
balance: 0.0,
}
const Wrapper = () => {
@ -37,7 +37,44 @@ describe('GddSend', () => {
expect(wrapper.find('div.transaction-form').exists()).toBeTruthy()
})
describe('transaction form disable because balance 0,0 GDD', () => {
it('has a disabled input field of type email', () => {
expect(wrapper.find('#input-group-1').find('input').attributes('disabled')).toBe('disabled')
})
it('has a disabled input field for amount', () => {
expect(wrapper.find('#input-2').find('input').attributes('disabled')).toBe('disabled')
})
it('has a disabled textarea field ', () => {
expect(wrapper.find('#input-3').find('textarea').attributes('disabled')).toBe('disabled')
})
it('has a message indicating that there are no GDDs to send ', () => {
expect(wrapper.find('.text-danger').text()).toBe('form.no_gdd_available')
})
it('has no reset button and no submit button ', () => {
expect(wrapper.find('.test-buttons').exists()).toBeFalsy()
})
})
describe('transaction form', () => {
beforeEach(() => {
wrapper.setProps({ balance: 100.0 })
})
describe('transaction form show because balance 100,0 GDD', () => {
it('has no warning message ', () => {
expect(wrapper.find('.text-danger').exists()).toBeFalsy()
})
it('has a reset button', () => {
expect(wrapper.find('.test-buttons').findAll('button').at(0).attributes('type')).toBe(
'reset',
)
})
it('has a submit button', () => {
expect(wrapper.find('.test-buttons').findAll('button').at(1).attributes('type')).toBe(
'submit',
)
})
})
describe('email field', () => {
it('has an input field of type email', () => {
expect(wrapper.find('#input-group-1').find('input').attributes('type')).toBe('email')

View File

@ -41,6 +41,7 @@
placeholder="E-Mail"
style="font-size: large"
class="pl-3"
:disabled="isBalanceDisabled"
></b-form-input>
</b-input-group>
<b-col v-if="errors">
@ -76,6 +77,7 @@
:placeholder="$n(0.01)"
style="font-size: large"
class="pl-3"
:disabled="isBalanceDisabled"
></b-form-input>
</b-input-group>
<b-col v-if="errors">
@ -105,6 +107,7 @@
v-model="form.memo"
class="pl-3"
style="font-size: large"
:disabled="isBalanceDisabled"
></b-form-textarea>
</b-input-group>
<b-col v-if="errors">
@ -114,7 +117,10 @@
</div>
<br />
<b-row>
<div v-if="!!isBalanceDisabled" class="text-danger">
{{ $t('form.no_gdd_available') }}
</div>
<b-row v-else class="test-buttons">
<b-col>
<b-button type="reset" variant="secondary" @click="onReset">
{{ $t('form.reset') }}
@ -192,6 +198,11 @@ export default {
this.form.email = this.form.email.trim()
},
},
computed: {
isBalanceDisabled() {
return this.balance <= 0 ? 'disabled' : false
},
},
}
</script>
<style>