From d9f8f8cb0775956d21612d63778fdc38f0bc6a2c Mon Sep 17 00:00:00 2001 From: ogerly Date: Mon, 16 Jan 2023 10:19:10 +0100 Subject: [PATCH 1/5] normalized-amount-transaction-if-processed again --- frontend/src/components/Inputs/InputAmount.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Inputs/InputAmount.vue b/frontend/src/components/Inputs/InputAmount.vue index 7a72a3a77..3268a0ec1 100644 --- a/frontend/src/components/Inputs/InputAmount.vue +++ b/frontend/src/components/Inputs/InputAmount.vue @@ -20,7 +20,7 @@ trim v-focus="amountFocused" @focus="amountFocused = true" - @blur="normalizeAmount(true)" + @blur="normalizeAmount(valid)" :disabled="disabled" autocomplete="off" > @@ -90,5 +90,8 @@ export default { this.currentValue = this.$n(this.amountValue, 'ungroupedDecimal') }, }, + mounted() { + if (this.value !== '') this.normalizeAmount(true) + }, } From b52162320d2e6939064cd5025ac0446946e39bba Mon Sep 17 00:00:00 2001 From: mahula Date: Tue, 17 Jan 2023 11:32:22 +0100 Subject: [PATCH 2/5] fix unit tests for amout input component --- frontend/src/components/Inputs/InputAmount.spec.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/frontend/src/components/Inputs/InputAmount.spec.js b/frontend/src/components/Inputs/InputAmount.spec.js index b2d524e08..b20ab0f23 100644 --- a/frontend/src/components/Inputs/InputAmount.spec.js +++ b/frontend/src/components/Inputs/InputAmount.spec.js @@ -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') }) }) From 782978579932fa6e45195310877fbbff64dd9788 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 17 Jan 2023 13:07:49 +0100 Subject: [PATCH 3/5] resolve conflicts --- frontend/src/components/Contributions/ContributionForm.spec.js | 1 + frontend/src/components/Inputs/InputAmount.spec.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/Contributions/ContributionForm.spec.js b/frontend/src/components/Contributions/ContributionForm.spec.js index bc7ed9785..020e3f552 100644 --- a/frontend/src/components/Contributions/ContributionForm.spec.js +++ b/frontend/src/components/Contributions/ContributionForm.spec.js @@ -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'], diff --git a/frontend/src/components/Inputs/InputAmount.spec.js b/frontend/src/components/Inputs/InputAmount.spec.js index b20ab0f23..ede54b8c3 100644 --- a/frontend/src/components/Inputs/InputAmount.spec.js +++ b/frontend/src/components/Inputs/InputAmount.spec.js @@ -9,10 +9,11 @@ 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)), + // $n: jest.fn((n) => String(n)), $route: { params: {}, }, From 808eee7ae26290bd6ab3190b1fdbcde59095c956 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 17 Jan 2023 15:39:01 +0100 Subject: [PATCH 4/5] session extend , remove creation from query verifyLogin --- frontend/src/graphql/queries.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index 65fde8d1d..3b1186a0c 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -13,7 +13,6 @@ export const verifyLogin = gql` hasElopage publisherId isAdmin - creation hideAmountGDD hideAmountGDT } From 35997f5499bbda70a62b36e4292bfbff64793181 Mon Sep 17 00:00:00 2001 From: ogerly Date: Tue, 17 Jan 2023 15:59:46 +0100 Subject: [PATCH 5/5] remove unused code --- frontend/src/components/Inputs/InputAmount.spec.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/components/Inputs/InputAmount.spec.js b/frontend/src/components/Inputs/InputAmount.spec.js index ede54b8c3..0b03ce769 100644 --- a/frontend/src/components/Inputs/InputAmount.spec.js +++ b/frontend/src/components/Inputs/InputAmount.spec.js @@ -13,7 +13,6 @@ describe('InputAmount', () => { $i18n: { locale: jest.fn(() => 'en'), }, - // $n: jest.fn((n) => String(n)), $route: { params: {}, },