diff --git a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js index f7a2238c8..d90f68b1f 100644 --- a/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js +++ b/src/layouts/service-location/mobile-location-modal-questions/mobile-location-modal-questions.spec.js @@ -332,8 +332,6 @@ describe("mobile-location-modal-questions.vue", () => { expect(wrapper.vm.internalModel.addressQuestions.streetAddress).toEqual(""); expect(wrapper.vm.internalModel.addressQuestions.apartmentNumberOrBusinessName).toEqual(""); expect(wrapper.vm.internalModel.addressQuestions.city).toEqual(""); - expect(wrapper.vm.internalModel.addressQuestions.state).toEqual(""); - expect(wrapper.vm.internalModel.addressQuestions.zipCode).toEqual(""); expect(wrapper.vm.internalModel.isVehicleProtected).toEqual(null); }); }); 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 ecd1345f0..6aceb6262 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 @@ -63,7 +63,6 @@ export default { return { internalModel: deepClone(this.modelValue), displayInvalidZipAlert: false, - modalName: "MobileLocationModalWidget", }; }, props: { @@ -108,6 +107,9 @@ export default { } return this.getCmsContent(this.linkWidgetName, "BodyText"); }, + modalName() { + return "MobileLocationModalWidget"; + }, modalHeaderText() { return this.getCmsContent(this.modalWidgetName, "HeaderText"); }, @@ -115,9 +117,6 @@ export default { const cmsContentText = this.getCmsContent("MobileFeeDisclaimerWidget", "Text"); return cmsContentText.replaceAll("{custom:mobileFee}", this.mobileFee); }, - modalFooterText() { - return this.getCmsContent(this.modalWidgetName, "FooterText"); - }, mobileFee() { if (!this.modelValue.mobileFeePart) { return 0; @@ -127,7 +126,11 @@ export default { this.modelValue.mobileFeePart.sellingPrice + this.modelValue.mobileFeePart.kitPrice ); + }, + modalFooterText() { + return this.getCmsContent(this.modalWidgetName, "FooterText"); }, + addressModel: { get: function () { return this.modelValue.addressQuestions; diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 6e09b6fa3..d60de2603 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -177,6 +177,12 @@ describe("service-location.vue", () => { wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn(); wrapper.vm.$refs.serviceZipCodeQuestion.resetMobileFeePart = jest.fn(); + const newServiceZipCodeQuestion = { + zipCode: "61606", + state: "IL", + isServiceable: true, + }; + const mobileLocationQuestions = { addressQuestions: { streetAddress: "5555 Sulgrave Dr", @@ -186,8 +192,7 @@ describe("service-location.vue", () => { zipCode: "43054", }, isVehicleProtected: true, - serviceZipCode: "43054", - mobileFee: 0, + mobileFeePart: null, }; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; @@ -196,11 +201,11 @@ describe("service-location.vue", () => { streetAddress: "", apartmentNumberOrBusinessName: "", city: "", - state: "", - zipCode: "", + state: "IL", + zipCode: "61606", }, isVehicleProtected: null, - serviceZipCode: "43081", + mobileFeePart: null }; const serviceZipCodeComponent = wrapper.findComponent({ @@ -208,7 +213,7 @@ describe("service-location.vue", () => { }); // Act - serviceZipCodeComponent.vm.$emit("updated-service-zip-code", "43081"); + serviceZipCodeComponent.vm.$emit("update:modelValue", newServiceZipCodeQuestion); // Assert expect(wrapper.vm.mobileLocationQuestions).toStrictEqual(newMobileLocationQuestions); @@ -230,7 +235,7 @@ describe("service-location.vue", () => { zipCode: "", }, isVehicleProtected: null, - serviceZipCode: "43081", + mobileFeePart: null, }; wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; @@ -243,8 +248,7 @@ describe("service-location.vue", () => { zipCode: "43054", }, isVehicleProtected: true, - serviceZipCode: "43054", - mobileFee: 0, + mobileFeePart: null, }; const mobileLocationComponent = wrapper.findComponent({ @@ -264,29 +268,50 @@ describe("service-location.vue", () => { wrapper.vm.$refs.mobileLocationModalQuestions.resetComponent = jest.fn(); wrapper.vm.$refs.serviceZipCodeQuestion.resetMobileFeePart = jest.fn(); - const serviceZipCodeInfo = { - state: "OH", - zipCode: "43054", - isServiceable: true, + const mobileLocationQuestions = { + addressQuestions: { + streetAddress: "", + apartmentNumberOrBusinessName: "", + city: "", + state: "", + zipCode: "", + }, + isVehicleProtected: null, + mobileFeePart: null, }; + wrapper.vm.mobileLocationQuestions = mobileLocationQuestions; - const newServiceZipCodeInfo = { - state: "OH", - zipCode: "43081", - isServiceable: true, + const newMobileLocationQuestions = { + addressQuestions: { + streetAddress: "5555 Rustic Dr", + apartmentNumberOrBusinessName: "Apt 1", + city: "Westerville", + state: "OH", + zipCode: "43081", + }, + isVehicleProtected: true, + mobileFeePart: null, }; - wrapper.vm.serviceZipCodeQuestion = serviceZipCodeInfo; const mobileLocationComponent = wrapper.findComponent({ ref: "mobileLocationModalQuestions", }); - // Act - mobileLocationComponent.vm.$emit("updated-zip-code", { + wrapper.vm.serviceZipCodeQuestion = { + zipCode: "61606", + state: "IL", + isServiceable: true, + }; + + const newServiceZipCodeInfo = { state: "OH", zipCode: "43081", isServiceable: true, - }); + }; + + + // Act + mobileLocationComponent.vm.$emit("update:modelValue", newMobileLocationQuestions); // Assert expect(wrapper.vm.serviceZipCodeQuestion).toStrictEqual(newServiceZipCodeInfo); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 1be600ed8..8e7e22833 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -128,12 +128,11 @@ export default { }, methods: { arePagePrerequisitesValid() { - return true; - // return ( - // store.getters.lineItems.supportingItems !== null && - // store.getters.order.serviceLocation.zipCode !== null && - // store.getters.payment.isInsurance !== null - // ); + return ( + store.getters.lineItems.supportingItems !== null && + store.getters.order.serviceLocation.zipCode !== null && + store.getters.payment.isInsurance !== null + ); }, setData(mobileFeePart) { if (mobileFeePart) {