From 159698c43858d2d276add8c30c21537bd3ccecc8 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 10 Jun 2024 16:01:59 -0400 Subject: [PATCH] update to only use 0 check on deductible coverage small linting update --- .../cart-dropdown/cart-dropdown.vue | 10 ++++----- .../payment-method/payment-method.spec.js | 8 +++---- src/layouts/payment-method/payment-method.vue | 22 ++++++++----------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/src/iss-components/cart-dropdown/cart-dropdown.vue b/src/iss-components/cart-dropdown/cart-dropdown.vue index 03570058..48677c2c 100644 --- a/src/iss-components/cart-dropdown/cart-dropdown.vue +++ b/src/iss-components/cart-dropdown/cart-dropdown.vue @@ -193,7 +193,7 @@ export default { isInitiallyExpanded: Boolean, submittedOrder: Object }, - emits: ['amountDueUpdated'], + emits: ['deductibleTotalUpdated'], data() { return { isExpanded: this.isInitiallyExpanded, @@ -216,7 +216,9 @@ export default { }, computed: { deductible() { - return getDeductible(this.cartOrder); + const newDeductibleTotal = getDeductible(this.cartOrder); + this.$emit('deductibleTotalUpdated', newDeductibleTotal); + return newDeductibleTotal; }, showDeductibleCartItem() { return this.isUnverified || (!this.isNoComp && !this.isITAC); @@ -250,9 +252,7 @@ export default { return getCartTotal(this.cartOrder); }, amountDue() { - const newAmountDue = this.showAsPaid ? 0 : this.total; - this.$emit('amountDueUpdated', newAmountDue); - return newAmountDue; + return this.showAsPaid ? 0 : this.total; }, amountPaid() { return !this.showAsPaid ? 0 : this.total; diff --git a/src/layouts/payment-method/payment-method.spec.js b/src/layouts/payment-method/payment-method.spec.js index c3261972..fce089bf 100644 --- a/src/layouts/payment-method/payment-method.spec.js +++ b/src/layouts/payment-method/payment-method.spec.js @@ -184,11 +184,11 @@ describe('payment-method.vue', () => { // Assert expect(result).toBeTruthy(); }); - test('returns false when coverageStatus is verified and cartAmountDue > 0', () => { + test('returns false when coverageStatus is verified and deductibleTotal > 0', () => { // Arrange store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; const wrapper = setupMocks({}, store, mixin); - wrapper.vm.cartAmountDue = 34.99; + wrapper.vm.deductibleTotal = 34.99; // Act const result = wrapper.vm.isPayInAdvanceDisabled; @@ -196,11 +196,11 @@ describe('payment-method.vue', () => { // Assert expect(result).toBeFalsy(); }); - test('returns true when coverageStatus is verified and cartAmountDue = 0', () => { + test('returns true when coverageStatus is verified and deductibleTotal = 0', () => { // Arrange store.order.insuranceCoverage.coverageStatus = coverageStatuses.VERIFIED; const wrapper = setupMocks({}, store, mixin); - wrapper.vm.cartAmountDue = 0; + wrapper.vm.deductibleTotal = 0; // Act const result = wrapper.vm.isPayInAdvanceDisabled; diff --git a/src/layouts/payment-method/payment-method.vue b/src/layouts/payment-method/payment-method.vue index f92340a9..6457386f 100644 --- a/src/layouts/payment-method/payment-method.vue +++ b/src/layouts/payment-method/payment-method.vue @@ -33,7 +33,7 @@ :isInitiallyExpanded="false" recyclingModalCmsWidgetName="RecycleModal" servicePackageTitleWidgetName="ServicePackageTitle" - @amountDueUpdated="updateAmountDue" /> + @deductibleTotalUpdated="updateDeductibleTotal" />