From df1d98e3b546dd76bc69ab54058df915f717e367 Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Tue, 29 Apr 2025 14:30:25 -0400 Subject: [PATCH] CASH-376 form validation fix --- .../mobile-location-modal-questions.vue | 1 + .../service-location/service-location.spec.js | 7 +++++++ src/layouts/service-location/service-location.vue | 12 +++++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue index 5b0a79255..ac597c72b 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.vue @@ -148,6 +148,7 @@ export default { zipCode: "", }, isVehicleProtected: null, + isMobileSelected: false, }), }, mobileFeePart: { diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 2b4e0d221..3b20c69f0 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -343,6 +343,7 @@ describe("service-location.vue", () => { zipCode: "43054", }, isVehicleProtected: true, + isMobileSelected: true, }; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; @@ -355,6 +356,7 @@ describe("service-location.vue", () => { zipCode: "61606", }, isVehicleProtected: null, + isMobileSelected: false, }; // Act @@ -457,6 +459,7 @@ describe("service-location.vue", () => { zipCode: "", }, isVehicleProtected: null, + isMobileSelected: false, }; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; const newMobileLocationQuestions = { @@ -468,6 +471,7 @@ describe("service-location.vue", () => { zipCode: "43054", }, isVehicleProtected: true, + isMobileSelected: true, }; wrapper.vm.closeModalAction = jest.fn(); @@ -517,6 +521,7 @@ describe("service-location.vue", () => { zipCode: "", }, isVehicleProtected: null, + isMobileSelected: false, mobileFeePart: null, }; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; @@ -530,6 +535,7 @@ describe("service-location.vue", () => { zipCode: "43081", }, isVehicleProtected: true, + isMobileSelected: true, mobileFeePart: null, }; @@ -593,6 +599,7 @@ describe("service-location.vue", () => { zipCode: "43081", }, isVehicleProtected: "YesAnswer", + isMobileSelected: true, }; wrapper.vm.closeModalAction = jest.fn(); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 02066d97e..cf6ffa043 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -171,11 +171,12 @@ const MOBILE_FEE_PART_TYPE = "MOBILE FEE"; // DEFINE VALIDATION RULES defineRule("mobile-location-required", (value) => { if ( - !value.addressQuestions.streetAddress || - !value.addressQuestions.city || - !value.addressQuestions.state || - !value.addressQuestions.zipCode || - !value.isVehicleProtected + value.isMobileSelected && + (!value.addressQuestions.streetAddress || + !value.addressQuestions.city || + !value.addressQuestions.state || + !value.addressQuestions.zipCode || + !value.isVehicleProtected) ) { return errorMessages.MOBILE_LOCATION_REQUIRED; } @@ -297,6 +298,7 @@ export default { zipCode: this.zipCode, }, isVehicleProtected: this.isVehicleProtected, + isMobileSelected: this.selectedAppointmentType === "Mobile", }; }, },