From 08459d274124ccdb0c4b1679659aa96f96a8a3ae Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 09:05:18 -0400 Subject: [PATCH 1/9] Added 'billToAccountNumber' required gate to 'getPricedMobileFeePart' --- .../helpers/service-location-helper/service-location-helper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index f9529ccec..22ea1a641 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -7,7 +7,7 @@ export async function getPricedMobileFeePart( parentAccountNumber, billToAccountNumber ) { - if (!serviceZipCode || !serviceType || !parentAccountNumber) { + if (!serviceZipCode || !serviceType || !parentAccountNumber || !billToAccountNumber) { return Promise.resolve(null); } From 6496b985b5a02b6f2fb53089d9dec88fc4c055e0 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 09:25:24 -0400 Subject: [PATCH 2/9] Removed unnecessary "emits" directive" --- .../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 cdba0058f..3a40ef9db 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 @@ -62,7 +62,7 @@ import { deepClone } from "@/layouts/service-location/helpers/object-cloning-hel export default { name: "mobile-location-modal-questions", - emits: ["update:modelValue", "updated-zip-code"], // The component emits an event + emits: ["update:modelValue"], // The component emits an event data() { return { internalModel: deepClone(this.modelValue), From dd35ef9ca251f28c3426aca65dae1f0df756fa5c Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 09:36:31 -0400 Subject: [PATCH 3/9] Moved resetMobileFeePart into service-location-helper --- .../service-location-helper.js | 16 ++++++++++++++ .../service-location/service-location.vue | 21 +++++-------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 22ea1a641..0622aead1 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -1,4 +1,5 @@ import { storeActions } from "@/constants/store-actions"; +import store from "@/store"; import baseMixin from "@/mixins/base-mixin.js"; export async function getPricedMobileFeePart( @@ -37,3 +38,18 @@ export async function getPricedMobileFeePart( return Promise.resolve(pricingResults[0]); } + +export async function resetMobileFeePart(serviceZipCode) { + const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; + const parentAccountNumber = store.getters.payment.parentAccountNumber; + const billToAccountNumber = 1; + + getPricedMobileFeePart( + serviceZipCode, + serviceType, + parentAccountNumber, + billToAccountNumber + ).then((pricedMobileFeePart) => { + this.mobileFeePart = pricedMobileFeePart; + }); +} diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index c4944f3ee..3872ab68a 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -37,7 +37,10 @@ import { Form } from "vee-validate"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; -import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { + getPricedMobileFeePart, + resetMobileFeePart, +} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; import store from "@/store"; export default { @@ -62,7 +65,7 @@ export default { const serviceZipCode = store.getters.order.serviceLocation.zipCode; const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; const parentAccountNumber = store.getters.payment.parentAccountNumber; - const billToAccountNumber = 0; + const billToAccountNumber = 1; const mobileFeePartPromise = getPricedMobileFeePart( serviceZipCode, @@ -157,20 +160,6 @@ export default { getServiceZipCodeFromStore() { return store.getters.order.serviceLocation.zipCode; }, - resetMobileFeePart(serviceZipCode) { - const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; - const parentAccountNumber = store.getters.payment.parentAccountNumber; - const billToAccountNumber = 0; - - getPricedMobileFeePart( - serviceZipCode, - serviceType, - parentAccountNumber, - billToAccountNumber - ).then((pricedMobileFeePart) => { - this.mobileFeePart = pricedMobileFeePart; - }); - }, resetMobileLocation(updatedServiceZipCodeInfo) { this.streetAddress = ""; this.apartmentNumberOrBusinessName = ""; From 99f6ef3a4e958c03029d0b4a36a773429a0baa7c Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 10:40:45 -0400 Subject: [PATCH 4/9] WIP --- .../service-location-helper.js | 14 -------------- .../mobile-location-modal-questions.vue | 16 +++++++++++++--- .../service-location/service-location.vue | 17 +++++++++-------- .../service-zip-modal-question.vue | 16 ++++++++++++++++ src/store/index.js | 2 +- 5 files changed, 39 insertions(+), 26 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index 0622aead1..ed05de924 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -39,17 +39,3 @@ export async function getPricedMobileFeePart( return Promise.resolve(pricingResults[0]); } -export async function resetMobileFeePart(serviceZipCode) { - const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; - const parentAccountNumber = store.getters.payment.parentAccountNumber; - const billToAccountNumber = 1; - - getPricedMobileFeePart( - serviceZipCode, - serviceType, - parentAccountNumber, - billToAccountNumber - ).then((pricedMobileFeePart) => { - this.mobileFeePart = pricedMobileFeePart; - }); -} 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 3a40ef9db..deb23e8e4 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 @@ -56,9 +56,11 @@ import modal from "@/digital-components/modal/modal"; import alert from "@/ux-components/alert/alert"; import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions"; import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question"; +import store from "@/store"; // Helpers import { deepClone } from "@/layouts/service-location/helpers/object-cloning-helper/object-cloning-helper"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; export default { name: "mobile-location-modal-questions", @@ -165,9 +167,6 @@ export default { resetModalButtonStyle() { this.$refs[this.modalName].resetButtonStyle(); }, - onAddressUpdated(updatedServiceZipCodeInfo) { - this.resetComponent(updatedServiceZipCodeInfo); - }, async setMobileLocation() { // Validate the Zip Code const zipCodeData = await this.getZipCodeData( @@ -178,6 +177,17 @@ export default { this.displayInvalidZipAlert = true; this.resetModalButtonStyle(); } else { + + // retrieve mobile fee part + const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; + const parentAccountNumber = store.getters.payment.parentAccountNumber; + const billToAccountNumber = 1; + + const mobileFeePart = await getPricedMobileFeePart(this.internalModel.addressQuestions.zipCode, serviceType, parentAccountNumber, billToAccountNumber); + + // emit it to parent + this.$emit("set-mobile-fee-part", mobileFeePart); + // Update the page level model this.$emit("update:modelValue", this.internalModel); this.closeModal(); diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index 3872ab68a..0242d7210 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -7,11 +7,14 @@ @@ -37,10 +40,7 @@ import { Form } from "vee-validate"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; -import { - getPricedMobileFeePart, - resetMobileFeePart, -} from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; import store from "@/store"; export default { @@ -104,7 +104,7 @@ export default { }, set: function (newValue) { if (newValue.zipCode !== this.zipCode) { - this.resetMobileLocation(newValue); + this.resetMobileLocation(); } this.state = newValue.state; @@ -160,14 +160,15 @@ export default { getServiceZipCodeFromStore() { return store.getters.order.serviceLocation.zipCode; }, - resetMobileLocation(updatedServiceZipCodeInfo) { + setMobileFeePart(mobileFeePart) { + this.mobileFeePart = mobileFeePart; + }, + resetMobileLocation() { this.streetAddress = ""; this.apartmentNumberOrBusinessName = ""; this.city = ""; this.isVehicleProtected = null; - - this.resetMobileFeePart(updatedServiceZipCodeInfo.zipCode); }, backButtonAction() { this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route); 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 4f4c98035..a54b90091 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 @@ -38,6 +38,8 @@ import textLink from "@/ux-components/text-link/text-link"; import serviceZipQuestion from "@/layouts/service-location/service-zip-modal-question/service-zip-question/service-zip-question"; import modal from "@/digital-components/modal/modal"; import alert from "@/ux-components/alert/alert"; +import store from "@/store"; +import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/service-location-helper/service-location-helper"; export default { name: "service-zip-modal-question", @@ -56,6 +58,10 @@ export default { zipCode: "", }), }, + mobileFeePart: { + type: Object, + default: () => ({}), + }, linkWidgetName: String, modalWidgetName: String, }, @@ -144,6 +150,16 @@ export default { } else { this.internalModel.state = zipCodeData.state; + // retrieve mobile fee part + const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; + const parentAccountNumber = store.getters.payment.parentAccountNumber; + const billToAccountNumber = 1; + + const mobileFeePart = await getPricedMobileFeePart(this.internalModel.zipCode, serviceType, parentAccountNumber, billToAccountNumber); + + // emit it to parent + this.$emit("set-mobile-fee-part", mobileFeePart); + // Update the page level model this.$emit("update:modelValue", this.internalModel); diff --git a/src/store/index.js b/src/store/index.js index 64acea595..c4c43aab4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -918,7 +918,7 @@ export const actions = { getMobileFeePart(context) { return globalMethods.callMockHttpClient({ method: endpoints.GetMobileFeePart.method, - endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce", //TODO: Remove Mocky Endpoint + endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce?mocky-delay=3000ms", //TODO: Remove Mocky Endpoint }); }, From bcee963f9aeab297e612c2d7ddee88df99ec1b13 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 13:25:26 -0400 Subject: [PATCH 5/9] Removed "initialValue" that shouldn't have been there --- .../address-questions/address-questions.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index 1769961b7..a119f1d81 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -50,7 +50,6 @@ v-model="addressModel.state" ref="state" :options="stateOptions" - initialValue="FL" validationRules="state-required" />
@@ -406,6 +405,11 @@ export default { } }, }, + modelValue: { + handler() { + this.setupAddressLookup(); + }, + }, }, components: { textboxQuestion, From 1613e192e3bbba49e7b127a1dad92b935c247800 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 13:27:12 -0400 Subject: [PATCH 6/9] Replaced GetMobileFeePart Mocky with real call --- src/store/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index c4c43aab4..9458b993d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -916,9 +916,13 @@ export const actions = { }, getMobileFeePart(context) { - return globalMethods.callMockHttpClient({ + const serviceType = context.getters.damage.isRepair ? "Repair" : "Replace"; + const parentAccountNumber = context.getters.payment.parentAccountNumber; + const billToAccountNumber = 87291; // TODO: MAKE THIS REAL + + return globalMethods.callHttpClient({ method: endpoints.GetMobileFeePart.method, - endpoint: "https://run.mocky.io/v3/795de4cb-d014-48b4-9338-dab33261adce?mocky-delay=3000ms", //TODO: Remove Mocky Endpoint + endpoint: `${endpoints.GetMobileFeePart.url}/${serviceType}/${parentAccountNumber}/${billToAccountNumber}`, }); }, From 8c82e8f9f9f92397585b882fa4c38e58e232dcb6 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 13:28:16 -0400 Subject: [PATCH 7/9] Added call to get mobile fee part in each component --- .../service-location-helper.js | 17 +++-------------- .../mobile-location-modal-questions.vue | 15 +++++++-------- .../service-zip-modal-question.vue | 14 +++++--------- 3 files changed, 15 insertions(+), 31 deletions(-) diff --git a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js index ed05de924..ba81a973f 100644 --- a/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js +++ b/src/layouts/service-location/helpers/service-location-helper/service-location-helper.js @@ -1,14 +1,8 @@ import { storeActions } from "@/constants/store-actions"; -import store from "@/store"; import baseMixin from "@/mixins/base-mixin.js"; -export async function getPricedMobileFeePart( - serviceZipCode, - serviceType, - parentAccountNumber, - billToAccountNumber -) { - if (!serviceZipCode || !serviceType || !parentAccountNumber || !billToAccountNumber) { +export async function getPricedMobileFeePart(serviceZipCode) { + if (!serviceZipCode) { return Promise.resolve(null); } @@ -17,11 +11,7 @@ export async function getPricedMobileFeePart( // Get the Mobile Fee Part const mobileFeePart = await baseMixin.methods.dispatchStoreAction( storeActions.GET_MOBILE_FEE_PART, - { - serviceType: serviceType, - parentAccountNumber: parentAccountNumber, - billToAccountNumber: billToAccountNumber, - }, + null, false ); @@ -38,4 +28,3 @@ export async function getPricedMobileFeePart( return Promise.resolve(pricingResults[0]); } - 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 deb23e8e4..9c5b87858 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 @@ -161,6 +161,7 @@ export default { values: { state: updatedServiceZipCodeInfo.state, zipCode: updatedServiceZipCodeInfo.zipCode, + isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected }, }); }, @@ -177,14 +178,11 @@ export default { this.displayInvalidZipAlert = true; this.resetModalButtonStyle(); } else { - // retrieve mobile fee part - const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; - const parentAccountNumber = store.getters.payment.parentAccountNumber; - const billToAccountNumber = 1; + const serviceZipCode = this.internalModel.addressQuestions.zipCode; + + const mobileFeePart = await getPricedMobileFeePart(serviceZipCode); - const mobileFeePart = await getPricedMobileFeePart(this.internalModel.addressQuestions.zipCode, serviceType, parentAccountNumber, billToAccountNumber); - // emit it to parent this.$emit("set-mobile-fee-part", mobileFeePart); @@ -200,8 +198,9 @@ export default { this.internalModel = deepClone(newValue); this.resetComponent({ - state: newValue.state, - zipCode: newValue.zipCode, + state: newValue.addressQuestions.state, + zipCode: newValue.addressQuestions.zipCode, + isVehicleProtected: newValue.isVehicleProtected }); }, deep: true, 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 a54b90091..c8397e490 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 @@ -61,7 +61,7 @@ export default { mobileFeePart: { type: Object, default: () => ({}), - }, + }, linkWidgetName: String, modalWidgetName: String, }, @@ -142,27 +142,23 @@ export default { this.resetAlerts(); const zipCodeData = await this.getZipCodeData(this.internalModel.zipCode); - this.resetModalButtonStyle(); - + if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true; this.focusOnZipInput(); + this.resetModalButtonStyle(); } else { this.internalModel.state = zipCodeData.state; // retrieve mobile fee part - const serviceType = store.getters.damage.isRepair ? "Repair" : "Replace"; - const parentAccountNumber = store.getters.payment.parentAccountNumber; - const billToAccountNumber = 1; + const serviceZipCode = this.internalModel.zipCode; + const mobileFeePart = await getPricedMobileFeePart(serviceZipCode); - const mobileFeePart = await getPricedMobileFeePart(this.internalModel.zipCode, serviceType, parentAccountNumber, billToAccountNumber); - // emit it to parent this.$emit("set-mobile-fee-part", mobileFeePart); // Update the page level model this.$emit("update:modelValue", this.internalModel); - this.closeModal(); } }, From f89705c7a13d015bbb0e0ebc33a1a032af9162d2 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 13:32:51 -0400 Subject: [PATCH 8/9] Prettified --- .../mobile-location-modal-questions.vue | 4 ++-- .../service-zip-modal-question/service-zip-modal-question.vue | 2 +- 2 files changed, 3 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 9c5b87858..9bba10910 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 @@ -161,7 +161,7 @@ export default { values: { state: updatedServiceZipCodeInfo.state, zipCode: updatedServiceZipCodeInfo.zipCode, - isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected + isVehicleProtected: updatedServiceZipCodeInfo.isVehicleProtected, }, }); }, @@ -200,7 +200,7 @@ export default { this.resetComponent({ state: newValue.addressQuestions.state, zipCode: newValue.addressQuestions.zipCode, - isVehicleProtected: newValue.isVehicleProtected + isVehicleProtected: newValue.isVehicleProtected, }); }, deep: true, 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 c8397e490..50041cec3 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 @@ -142,7 +142,7 @@ export default { this.resetAlerts(); const zipCodeData = await this.getZipCodeData(this.internalModel.zipCode); - + if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true; this.focusOnZipInput(); From 0d5231ff8702a4aa8f9d7de4505f53484a6630c3 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 14 Mar 2023 13:59:24 -0400 Subject: [PATCH 9/9] Fixed unit tests --- .../mobile-location-modal-questions.spec.js | 26 +++++++++++++++++ .../mobile-location-modal-questions.vue | 2 +- .../service-zip-modal-question.spec.js | 28 +++++++++++++++++++ .../service-zip-modal-question.vue | 1 + 4 files changed, 56 insertions(+), 1 deletion(-) 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 ab0ba6573..fbea693b9 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 @@ -93,6 +93,32 @@ const mockMixin = { }, }; +const mockGetPricedMobileFeePart = (mockServiceZipCode) => { + let mobileFeePart = {}; + + if (mockServiceZipCode === "43235") { + mobileFeePart = { + partNumber: "MOBILE FEE", + description: "MOBILE FEE", + partType: "FEE", + laborAmount: 49.99, + sellingPrice: 0, + kitPrice: 0, + }; + } + + return Promise.resolve(mobileFeePart); +}; + +jest.mock( + "@/layouts/service-location/helpers/service-location-helper/service-location-helper", + () => ({ + getPricedMobileFeePart: jest.fn((mockServiceZipCode) => { + return mockGetPricedMobileFeePart(mockServiceZipCode); + }), + }) +); + describe("mobile-location-modal-questions.vue", () => { it("Should copy the modelValue to the internalModel when the component is mounted", async () => { // Arrange 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 9bba10910..b4da4ddfa 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"], // The component emits an event + emits: ["update:modelValue", "set-mobile-fee-part"], data() { return { internalModel: deepClone(this.modelValue), diff --git a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js index becbd9ebd..407e129cf 100644 --- a/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js +++ b/src/layouts/service-location/service-zip-modal-question/service-zip-modal-question.spec.js @@ -16,6 +16,32 @@ jest.mock("@/digital-components/modal/modal", () => ({ }, })); +const mockGetPricedMobileFeePart = (mockServiceZipCode) => { + let mobileFeePart = {}; + + if (mockServiceZipCode === "43235") { + mobileFeePart = { + partNumber: "MOBILE FEE", + description: "MOBILE FEE", + partType: "FEE", + laborAmount: 49.99, + sellingPrice: 0, + kitPrice: 0, + }; + } + + return Promise.resolve(mobileFeePart); +}; + +jest.mock( + "@/layouts/service-location/helpers/service-location-helper/service-location-helper", + () => ({ + getPricedMobileFeePart: jest.fn((mockServiceZipCode) => { + return mockGetPricedMobileFeePart(mockServiceZipCode); + }), + }) +); + const linkWidgetName = "linkWidgetName"; const modalWidgetName = "modalWidgetName"; @@ -126,6 +152,7 @@ describe("service-zip-modal-question.vue", () => { mixins: [mockMixin], props: { modelValue: serviceZipCodeQuestion, + mobileFeePart: {}, linkWidgetName: linkWidgetName, modalWidgetName: modalWidgetName, }, @@ -134,6 +161,7 @@ describe("service-zip-modal-question.vue", () => { // Act wrapper.vm.internalModel.zipCode = zip; + await wrapper.vm.setZipCode(); let expectedEmit = [[{ state: "OH", zipCode: "43235" }]]; 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 50041cec3..2c1e0e588 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,6 +43,7 @@ import { getPricedMobileFeePart } from "@/layouts/service-location/helpers/servi export default { name: "service-zip-modal-question", + emits: ["update:modelValue", "set-mobile-fee-part"], data() { return { internalModel: this.copyModel(this.modelValue),