Updates for emitting contains military zip

This commit is contained in:
Bill Richardson 2023-03-16 16:00:08 -04:00
parent 195dc954ff
commit 14541d110c
3 changed files with 19 additions and 18 deletions

View file

@ -319,11 +319,15 @@ describe("service-location.vue", () => {
state: "OH", state: "OH",
}; };
// Assert const serviceZipCodeComponent = wrapper.findComponent({
wrapper.setData({ zipCode: newServiceZipCodeQuestion.zipCode }); ref: "serviceZipCodeQuestion",
wrapper.vm.$nextTick(() => {
expect(wrapper.vm.zipContainsMilitaryBase).toBe(true);
}); });
// Act
serviceZipCodeComponent.vm.$emit("updated-contains-military-base", true);
// Assert
expect(wrapper.vm.zipContainsMilitaryBase).toBe(true);
}); });
}); });

View file

@ -10,7 +10,8 @@
:mobileFeePart="mobileFeePart" :mobileFeePart="mobileFeePart"
@updated-mobile-fee-part="setMobileFeePart" @updated-mobile-fee-part="setMobileFeePart"
linkWidgetName="ServiceZipLinkWidget" linkWidgetName="ServiceZipLinkWidget"
modalWidgetName="ServiceZipModalWidget" /> modalWidgetName="ServiceZipModalWidget"
@updated-contains-military-base="setContainsMilitaryBase" />
<alert <alert
class="my-4" class="my-4"
cmsWidgetName="AlertMilitaryBaseZipWidget" cmsWidgetName="AlertMilitaryBaseZipWidget"
@ -26,7 +27,7 @@
<funnel-footer <funnel-footer
cmsWidgetName="FunnelFooterWidget" cmsWidgetName="FunnelFooterWidget"
ref="funnelFooter" ref="funnelFooter"
:isForwardActionDisabled="!meta.valid || shouldDisableForwardAction" :isForwardActionDisabled="!meta.valid"
@back-clicked="backButtonAction" @back-clicked="backButtonAction"
@ForwardClicked="forwardButtonAction" /> @ForwardClicked="forwardButtonAction" />
</div> </div>
@ -141,9 +142,6 @@ export default {
this.isVehicleProtected = newValue.isVehicleProtected; this.isVehicleProtected = newValue.isVehicleProtected;
}, },
}, },
shouldDisableForwardAction() {
return this.zipContainsMilitaryBase;
},
}, },
methods: { methods: {
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
@ -158,6 +156,11 @@ export default {
this.mobileFeePart = mobileFeePart; this.mobileFeePart = mobileFeePart;
} }
}, },
setContainsMilitaryBase(val) {
if (this.zipContainsMilitaryBase !== val) {
this.zipContainsMilitaryBase = val;
}
},
getServiceAddressFromStore() { getServiceAddressFromStore() {
return store.getters.order.serviceLocation.address; return store.getters.order.serviceLocation.address;
}, },
@ -187,15 +190,6 @@ export default {
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
}, },
}, },
watch: {
zipCode(current, previous) {
if (current !== previous) {
baseMixin.methods.getZipCodeData(current).then((r) => {
this.zipContainsMilitaryBase = r.containsMilitaryBase;
});
}
},
},
components: { components: {
alert, alert,
serviceZipModalQuestion, serviceZipModalQuestion,

View file

@ -44,6 +44,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi
export default { export default {
name: "service-zip-modal-question", name: "service-zip-modal-question",
emits: ["update:modelValue", "updated-mobile-fee-part"], emits: ["update:modelValue", "updated-mobile-fee-part"],
emits: ["updated-contains-military-base"],
data() { data() {
return { return {
internalModel: this.copyModel(this.modelValue), internalModel: this.copyModel(this.modelValue),
@ -160,6 +161,8 @@ export default {
// Update the page level model // Update the page level model
this.$emit("update:modelValue", this.internalModel); this.$emit("update:modelValue", this.internalModel);
this.$emit("updated-contains-military-base", zipCodeData.containsMilitaryBase);
this.closeModal(); this.closeModal();
} }
}, },