mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #2550 from gradido/2547-normalized-amount-transaction-is-processed-again
fix(frontend): normalized amount transaction if processed again
This commit is contained in:
commit
79faae526c
@ -23,6 +23,7 @@ describe('ContributionForm', () => {
|
||||
const mocks = {
|
||||
$t: jest.fn((t) => t),
|
||||
$d: jest.fn((d) => d),
|
||||
$n: jest.fn((n) => n),
|
||||
$store: {
|
||||
state: {
|
||||
creation: ['1000', '1000', '1000'],
|
||||
|
||||
@ -9,10 +9,10 @@ describe('InputAmount', () => {
|
||||
|
||||
const mocks = {
|
||||
$t: jest.fn((t) => t),
|
||||
$n: jest.fn((n) => n),
|
||||
$i18n: {
|
||||
locale: jest.fn(() => 'en'),
|
||||
},
|
||||
$n: jest.fn((n) => String(n)),
|
||||
$route: {
|
||||
params: {},
|
||||
},
|
||||
@ -46,13 +46,14 @@ describe('InputAmount', () => {
|
||||
|
||||
describe('amount normalization', () => {
|
||||
describe('if invalid', () => {
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setProps({ value: '12m34' })
|
||||
valid = false
|
||||
})
|
||||
|
||||
it('is not normalized', () => {
|
||||
wrapper.vm.normalizeAmount(valid)
|
||||
expect(wrapper.vm.amountValue).toBe(0.0)
|
||||
wrapper.vm.normalizeAmount(false)
|
||||
expect(wrapper.vm.currentValue).toBe('12m34')
|
||||
})
|
||||
})
|
||||
|
||||
@ -97,13 +98,14 @@ describe('InputAmount', () => {
|
||||
|
||||
describe('amount normalization', () => {
|
||||
describe('if invalid', () => {
|
||||
beforeEach(() => {
|
||||
beforeEach(async () => {
|
||||
await wrapper.setProps({ value: '12m34' })
|
||||
valid = false
|
||||
})
|
||||
|
||||
it('is not normalized', () => {
|
||||
wrapper.vm.normalizeAmount(valid)
|
||||
expect(wrapper.vm.amountValue).toBe(0.0)
|
||||
expect(wrapper.vm.currentValue).toBe('12m34')
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
trim
|
||||
v-focus="amountFocused"
|
||||
@focus="amountFocused = true"
|
||||
@blur="normalizeAmount(true)"
|
||||
@blur="normalizeAmount(valid)"
|
||||
:disabled="disabled"
|
||||
autocomplete="off"
|
||||
></b-form-input>
|
||||
@ -90,5 +90,8 @@ export default {
|
||||
this.currentValue = this.$n(this.amountValue, 'ungroupedDecimal')
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
if (this.value !== '') this.normalizeAmount(true)
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
@ -13,7 +13,6 @@ export const verifyLogin = gql`
|
||||
hasElopage
|
||||
publisherId
|
||||
isAdmin
|
||||
creation
|
||||
hideAmountGDD
|
||||
hideAmountGDT
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user