From 14541d110c0ddcd0216eb76e4ea6ba4a61dfcdbf Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 16 Mar 2023 16:00:08 -0400 Subject: [PATCH 1/4] Updates for emitting contains military zip --- .../service-location/service-location.spec.js | 12 ++++++---- .../service-location/service-location.vue | 22 +++++++------------ .../service-zip-modal-question.vue | 3 +++ 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 0653e91f0..b48fa2f06 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -319,11 +319,15 @@ describe("service-location.vue", () => { state: "OH", }; - // Assert - wrapper.setData({ zipCode: newServiceZipCodeQuestion.zipCode }); - wrapper.vm.$nextTick(() => { - expect(wrapper.vm.zipContainsMilitaryBase).toBe(true); + const serviceZipCodeComponent = wrapper.findComponent({ + ref: "serviceZipCodeQuestion", }); + + // Act + serviceZipCodeComponent.vm.$emit("updated-contains-military-base", true); + + // Assert + expect(wrapper.vm.zipContainsMilitaryBase).toBe(true); }); }); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 58f440708..732b0f0b1 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -10,7 +10,8 @@ :mobileFeePart="mobileFeePart" @updated-mobile-fee-part="setMobileFeePart" linkWidgetName="ServiceZipLinkWidget" - modalWidgetName="ServiceZipModalWidget" /> + modalWidgetName="ServiceZipModalWidget" + @updated-contains-military-base="setContainsMilitaryBase" /> @@ -141,9 +142,6 @@ export default { this.isVehicleProtected = newValue.isVehicleProtected; }, }, - shouldDisableForwardAction() { - return this.zipContainsMilitaryBase; - }, }, methods: { arePagePrerequisitesValid() { @@ -158,6 +156,11 @@ export default { this.mobileFeePart = mobileFeePart; } }, + setContainsMilitaryBase(val) { + if (this.zipContainsMilitaryBase !== val) { + this.zipContainsMilitaryBase = val; + } + }, getServiceAddressFromStore() { return store.getters.order.serviceLocation.address; }, @@ -187,15 +190,6 @@ export default { navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); }, }, - watch: { - zipCode(current, previous) { - if (current !== previous) { - baseMixin.methods.getZipCodeData(current).then((r) => { - this.zipContainsMilitaryBase = r.containsMilitaryBase; - }); - } - }, - }, components: { alert, serviceZipModalQuestion, diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index 0d2c35000..1b665b5d5 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -44,6 +44,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi export default { name: "service-zip-modal-question", emits: ["update:modelValue", "updated-mobile-fee-part"], + emits: ["updated-contains-military-base"], data() { return { internalModel: this.copyModel(this.modelValue), @@ -160,6 +161,8 @@ export default { // Update the page level model this.$emit("update:modelValue", this.internalModel); + this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); + this.closeModal(); } }, From c4f0624f10783aef909cd85a9b557229460b106d Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 16 Mar 2023 16:49:14 -0400 Subject: [PATCH 2/4] Contains Military zip emit on Location questions modal --- .../mobile-location-modal-questions.vue | 2 ++ src/layouts/service-location/service-location.vue | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 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 586e1c6de..78d1cc672 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 @@ -65,6 +65,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi export default { name: "mobile-location-modal-questions", emits: ["update:modelValue", "updated-mobile-fee-part"], + emits: ["update:modelValue", "updated-zip-code", "updated-contains-military-base"], // The component emits an event data() { return { internalModel: deepClone(this.modelValue), @@ -187,6 +188,7 @@ export default { // Update the page level model this.$emit("update:modelValue", this.internalModel); + this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase); this.closeModal(); } }, diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 732b0f0b1..5969ac216 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -10,12 +10,12 @@ :mobileFeePart="mobileFeePart" @updated-mobile-fee-part="setMobileFeePart" linkWidgetName="ServiceZipLinkWidget" - modalWidgetName="ServiceZipModalWidget" + modalWidgetName="ServiceZipModalWidget" @updated-contains-military-base="setContainsMilitaryBase" /> + modalWidgetName="MobileLocationModalWidget" + @updated-contains-military-base="setContainsMilitaryBase" /> Date: Mon, 20 Mar 2023 10:49:12 -0400 Subject: [PATCH 3/4] Updates after merge --- .../mobile-location-modal-questions.vue | 3 +-- .../service-zip-modal-question/service-zip-modal-question.vue | 3 +-- 2 files changed, 2 insertions(+), 4 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 78d1cc672..8773b5daf 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 @@ -64,8 +64,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi export default { name: "mobile-location-modal-questions", - emits: ["update:modelValue", "updated-mobile-fee-part"], - emits: ["update:modelValue", "updated-zip-code", "updated-contains-military-base"], // The component emits an event + emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base"], // The component emits an event data() { return { internalModel: deepClone(this.modelValue), diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue index 1b665b5d5..174b74523 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.vue @@ -43,8 +43,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi export default { name: "service-zip-modal-question", - emits: ["update:modelValue", "updated-mobile-fee-part"], - emits: ["updated-contains-military-base"], + emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base"], data() { return { internalModel: this.copyModel(this.modelValue), From 9fd6a08dd8ea1f71bfae6aa3f3821c20312e1629 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Mon, 20 Mar 2023 11:00:31 -0400 Subject: [PATCH 4/4] remove comment that was removed previously --- .../mobile-location-modal-questions.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8773b5daf..85726aebd 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 @@ -64,7 +64,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi export default { name: "mobile-location-modal-questions", - emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base"], // The component emits an event + emits: ["update:modelValue", "updated-mobile-fee-part", "updated-contains-military-base"], data() { return { internalModel: deepClone(this.modelValue),