diff --git a/src/digital-components/date-picker/date-picker.vue b/src/digital-components/date-picker/date-picker.vue index 642c90174..e008021db 100644 --- a/src/digital-components/date-picker/date-picker.vue +++ b/src/digital-components/date-picker/date-picker.vue @@ -1354,23 +1354,6 @@ export default { } } } - - .inshop-version { - color: limegreen !important; // TODO - THIS IS TEMPORARY CODE; TO BE REMOVED AS PART OF CASH-845 - } - .mobile-version { - color: red !important; // TODO - THIS IS TEMPORARY CODE; TO BE REMOVED AS PART OF CASH-845 - } - .radio-wrapper.inshop-version { - &.selectable-day label span { - color: limegreen !important; // TODO - THIS IS TEMPORARY CODE; TO BE REMOVED AS PART OF CASH-845 - } - } - .radio-wrapper.mobile-version { - &.selectable-day label span { - color: red !important; // TODO - THIS IS TEMPORARY CODE; TO BE REMOVED AS PART OF CASH-845 - } - } } } :deep(.timeslots .button-inner-wrapper) { diff --git a/src/digital-components/textbox-question/textbox-question.vue b/src/digital-components/textbox-question/textbox-question.vue index 3544a19d8..7df4436f1 100644 --- a/src/digital-components/textbox-question/textbox-question.vue +++ b/src/digital-components/textbox-question/textbox-question.vue @@ -50,6 +50,7 @@ :autocomplete="autocomplete" /> @@ -185,6 +186,7 @@ export default { // Focus cursor in input when search icon is clicked const field = document.querySelector("input"); field.focus(); + this.$emit("search-icon-click"); }, async imageChanged(e) { let file = e.target.files[0]; diff --git a/src/global-methods.js b/src/global-methods.js index 75fabb356..5528e42c6 100644 --- a/src/global-methods.js +++ b/src/global-methods.js @@ -9,6 +9,7 @@ import { GaCategories, GaActions, GaLabels } from "@/constants/analytics"; import { getSessionKeyValue } from "@/helpers/heritage-integration/cookie-helper"; import { headerKeys } from "@/constants/header-keys"; import axiosResponseInterceptorMessages from "@/constants/axios-response-interceptor-messages.js"; +import { endpoints } from "@/constants/endpoints"; // Add a response interceptor for global axios error handing. axios.interceptors.response.use( @@ -100,7 +101,7 @@ export default { return resolve(response); }, (error) => { - if (endpoint.toLowerCase().includes("/digitalconsumer-log")) { + if (endpoint.toLowerCase().includes(endpoints.LogDigitalConsumer.url)) { return resolve({ data: null, error: "Ignore errors when logging" }); } else { if (logApiCall) { diff --git a/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue b/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue index 32960509c..e9f631972 100644 --- a/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue +++ b/src/layouts/quote/afterpay-modal-banner/afterpay-modal-banner.vue @@ -101,11 +101,6 @@ export default { baseMixin.methods.filterOutFees(allLineItems) ); - let vapsLineItemsForSelectedPackage = this.lineItems.vaps; - vapsLineItemsForSelectedPackage.forEach((lineItem) => { - price += baseMixin.methods.getTotalLineItemPrice(lineItem); - }); - if (this.lineItems.promos) { let allLineItems = getArrayOfAllLineItemsAndChildParts(this.lineItems); const promos = getPromosThatMatchLineItemsOnOrder( @@ -119,12 +114,6 @@ export default { return price; }, - afterpayPrice() { - let price = this.getTierOnePackagePrice; - const adjusted = (price / 4).toFixed(2); - - return `$${adjusted}`; - }, showAfterpayExtendedPayOption() { return ( this.afterpayExtendedPayOptionThreshold && @@ -175,15 +164,13 @@ export default { > div:last-of-type { color: $gray-650; text-align: left; + @include media-breakpoint-down(md) { padding-top: 1rem; } @include media-breakpoint-up(md) { padding-left: 1rem; - - extended-pay-option { - max-width: 28rem; - } + max-width: 26rem; } } diff --git a/src/layouts/schedule/schedule.vue b/src/layouts/schedule/schedule.vue index 98f5d60ea..ee2096c36 100644 --- a/src/layouts/schedule/schedule.vue +++ b/src/layouts/schedule/schedule.vue @@ -76,6 +76,7 @@ import { } from "@/layouts/schedule/helpers/schedule-helper"; import { AppointmentTypeStrings, + RouteCodeFlags, PREMIUM_FEE_PART_TYPE, PRICING_BY_DAY_PART_TYPE, } from "@/constants/schedule-constants"; @@ -447,7 +448,7 @@ export default { if (this.isMobileSelected) { return "Mobile"; } else { - return "Inshop"; + return "InshopOrDropoff"; } }, getServiceMinutesMin() { @@ -569,10 +570,14 @@ export default { timeSlotInfo.timeSlot.date )}`; - if (this.appointmentType === AppointmentTypeStrings.IN_SHOP) { - navbarButtonText += ` at ${this.getDisplayTextForMilitaryTime( - timeSlotInfo.timeSlot.startTime - )}`; + if (this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF) { + if ( + !timeSlotInfo.timeSlot.routeCode.includes(RouteCodeFlags.ALL_DAY_DROP_OFF) + ) { + navbarButtonText += ` at ${this.getDisplayTextForMilitaryTime( + timeSlotInfo.timeSlot.startTime + )}`; + } } else if ( this.appointmentType === AppointmentTypeStrings.MOBILE && !timeSlotInfo.isPremiumAppointment diff --git a/src/layouts/schedule/time-slot-question/time-slot-question.vue b/src/layouts/schedule/time-slot-question/time-slot-question.vue index e3d2ef691..2d67ddc90 100644 --- a/src/layouts/schedule/time-slot-question/time-slot-question.vue +++ b/src/layouts/schedule/time-slot-question/time-slot-question.vue @@ -33,7 +33,7 @@ class="mt-4 timeslots" :class="[ isMobileAppointment ? 'is-mobile-appointment' : '', - isDropOffAppointment ? 'is-drop-off-appointment' : '', + isInshopOrDropOffAppointment ? 'is-inshop-or-drop-off-appointment' : '', ]" :answers="availableTimeSlots" groupName="chooseTimeSlot" @@ -354,7 +354,9 @@ export default { if (this.appointmentType === AppointmentTypeStrings.MOBILE) { return this.getAvailableTimeSlotsForMobile(this.timeSlotsForSelectedDate.timeSlots); } else { - return this.getAvailableTimeSlotsForInshop(this.timeSlotsForSelectedDate.timeSlots); + return this.getAvailableTimeSlotsForInshopOrDropOff( + this.timeSlotsForSelectedDate.timeSlots + ); } }, answersForDropOffQuestion() { @@ -408,8 +410,8 @@ export default { isMobileAppointment() { return this.appointmentType === AppointmentTypeStrings.MOBILE; }, - isDropOffAppointment() { - return this.appointmentType === AppointmentTypeStrings.DROP_OFF; + isInshopOrDropOffAppointment() { + return this.appointmentType === AppointmentTypeStrings.IN_SHOP_OR_DROP_OFF; }, shouldDisplayDropOffAlert() { return this.isDropOffRouteCode(this.selectedAnswerForDropOff); @@ -472,6 +474,26 @@ export default { }; }); }, + getAvailableTimeSlotsForInshopOrDropOff(timeSlotsForSelectedDate) { + const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => { + let buttonLabelValue; + if (timeSlot.id.includes(RouteCodeFlags.ALL_DAY_DROP_OFF)) { + buttonLabelValue = this.dropoffButtonText; + } else if (timeSlot.id.includes(RouteCodeFlags.OVERNIGHT_DROP_OFF)) { + buttonLabelValue = this.overnightDropoffButtonText; + } else if (this.isSameDay) { + buttonLabelValue = this.sameDayDropoffButtonText; + } else { + buttonLabelValue = militaryToTwelveHourTime(timeSlot.startTime); + } + return { + value: timeSlot.id, + buttonLabel: buttonLabelValue, + }; + }); + + return availableTimeSlots; + }, getAvailableTimeSlotsForMobile(timeSlotsForSelectedDate) { const availableTimeSlots = timeSlotsForSelectedDate.map((timeSlot) => { const readableTime = `${militaryToTwelveHourTime(timeSlot.startTime)} - ${militaryToTwelveHourTime( diff --git a/src/layouts/service-location/service-location.spec.js b/src/layouts/service-location/service-location.spec.js index 551e15ae0..68e9e9481 100644 --- a/src/layouts/service-location/service-location.spec.js +++ b/src/layouts/service-location/service-location.spec.js @@ -219,7 +219,13 @@ describe("service-location.vue", () => { // Arrange const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + /* ******NOTE: if we ever want to revert back to the old way of service location using shopQuestion instead of shopQuestionPopup uncomment all 30 of the lines in this file that read - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); - , and commment all of the blocks of code referencing shopQuestionPopup directly under them. Also remove reference to shopQuestionPopup in the setupMocks function*/ + + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ ref: "shopQuestionPopup" }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } const mobileFeePart = { partNumber: "MOBILE FEE", @@ -387,7 +393,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -414,7 +426,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -441,7 +459,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -468,7 +492,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -495,7 +525,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -523,7 +559,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -551,7 +593,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -579,7 +627,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -607,7 +661,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -635,7 +695,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -663,7 +729,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -691,7 +763,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -719,7 +797,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -747,7 +831,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -775,7 +865,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -806,7 +902,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -833,7 +935,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -860,7 +968,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -888,7 +1002,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -916,7 +1036,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -944,7 +1070,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -974,7 +1106,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1002,7 +1140,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1030,7 +1174,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1058,7 +1208,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1086,7 +1242,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1114,7 +1276,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1142,7 +1310,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1172,7 +1346,13 @@ describe("service-location.vue", () => { const { wrapper } = setupMocks({}); - wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + //wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn(); + const shopQuestionPopupComponent = wrapper.findComponent({ + ref: "shopQuestionPopup", + }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } // Act await serviceLocation.beforeRouteEnter.call( @@ -1199,5 +1379,12 @@ function setupMocks({ mountOptionsMockData = {} }) { const mountOptions = getMountOptions(mountOptionsMockData); const wrapper = shallowMount(serviceLocation, mountOptions); wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent; + if (!wrapper.vm.shopProviderData) { + wrapper.vm.shopProviderData = { shopProviders: [] }; + } + const shopQuestionPopupComponent = wrapper.findComponent({ ref: "shopQuestionPopup" }); + if (shopQuestionPopupComponent.exists()) { + shopQuestionPopupComponent.vm.initializeComponent = jest.fn(); + } return { wrapper, apiPromise }; } diff --git a/src/layouts/service-location/service-location.vue b/src/layouts/service-location/service-location.vue index ccb2c7866..776fe1199 100644 --- a/src/layouts/service-location/service-location.vue +++ b/src/layouts/service-location/service-location.vue @@ -89,6 +89,19 @@