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 = {
|
const mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
$d: jest.fn((d) => d),
|
$d: jest.fn((d) => d),
|
||||||
|
$n: jest.fn((n) => n),
|
||||||
$store: {
|
$store: {
|
||||||
state: {
|
state: {
|
||||||
creation: ['1000', '1000', '1000'],
|
creation: ['1000', '1000', '1000'],
|
||||||
|
|||||||
@ -9,10 +9,10 @@ describe('InputAmount', () => {
|
|||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
|
$n: jest.fn((n) => n),
|
||||||
$i18n: {
|
$i18n: {
|
||||||
locale: jest.fn(() => 'en'),
|
locale: jest.fn(() => 'en'),
|
||||||
},
|
},
|
||||||
$n: jest.fn((n) => String(n)),
|
|
||||||
$route: {
|
$route: {
|
||||||
params: {},
|
params: {},
|
||||||
},
|
},
|
||||||
@ -46,13 +46,14 @@ describe('InputAmount', () => {
|
|||||||
|
|
||||||
describe('amount normalization', () => {
|
describe('amount normalization', () => {
|
||||||
describe('if invalid', () => {
|
describe('if invalid', () => {
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
|
await wrapper.setProps({ value: '12m34' })
|
||||||
valid = false
|
valid = false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('is not normalized', () => {
|
it('is not normalized', () => {
|
||||||
wrapper.vm.normalizeAmount(valid)
|
wrapper.vm.normalizeAmount(false)
|
||||||
expect(wrapper.vm.amountValue).toBe(0.0)
|
expect(wrapper.vm.currentValue).toBe('12m34')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -97,13 +98,14 @@ describe('InputAmount', () => {
|
|||||||
|
|
||||||
describe('amount normalization', () => {
|
describe('amount normalization', () => {
|
||||||
describe('if invalid', () => {
|
describe('if invalid', () => {
|
||||||
beforeEach(() => {
|
beforeEach(async () => {
|
||||||
|
await wrapper.setProps({ value: '12m34' })
|
||||||
valid = false
|
valid = false
|
||||||
})
|
})
|
||||||
|
|
||||||
it('is not normalized', () => {
|
it('is not normalized', () => {
|
||||||
wrapper.vm.normalizeAmount(valid)
|
wrapper.vm.normalizeAmount(valid)
|
||||||
expect(wrapper.vm.amountValue).toBe(0.0)
|
expect(wrapper.vm.currentValue).toBe('12m34')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
trim
|
trim
|
||||||
v-focus="amountFocused"
|
v-focus="amountFocused"
|
||||||
@focus="amountFocused = true"
|
@focus="amountFocused = true"
|
||||||
@blur="normalizeAmount(true)"
|
@blur="normalizeAmount(valid)"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
></b-form-input>
|
></b-form-input>
|
||||||
@ -90,5 +90,8 @@ export default {
|
|||||||
this.currentValue = this.$n(this.amountValue, 'ungroupedDecimal')
|
this.currentValue = this.$n(this.amountValue, 'ungroupedDecimal')
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mounted() {
|
||||||
|
if (this.value !== '') this.normalizeAmount(true)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -13,7 +13,6 @@ export const verifyLogin = gql`
|
|||||||
hasElopage
|
hasElopage
|
||||||
publisherId
|
publisherId
|
||||||
isAdmin
|
isAdmin
|
||||||
creation
|
|
||||||
hideAmountGDD
|
hideAmountGDD
|
||||||
hideAmountGDT
|
hideAmountGDT
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user