Just needs styling tweaks and de-mocked

This commit is contained in:
Leah Schumann 2023-04-18 08:32:43 -04:00
parent 4def7c421e
commit d2ed91e919
3 changed files with 49 additions and 24 deletions

View file

@ -586,7 +586,7 @@ describe("service-location.vue", () => {
);
const { wrapper } = setupMocks({});
wrapper.vm.$refs.shopQuestion.initializeComponent = jest.fn();
// Act

View file

@ -66,12 +66,12 @@
modalWidgetName="MobileLocationModalWidget" />
<shopQuestion
ref="shopQuestion"
v-show="
selectedAppointmentType === 'Dropoff' || selectedAppointmentType === 'Inshop'
"
v-if="selectedAppointmentType === 'Inshop' || selectedAppointmentType === 'Dropoff'"
v-model="selectedShop"
:isDropoff="isDropoff"
:serviceZipCode="zipCode"
:selectedAppointmentType="selectedAppointmentType"
:shopQuestionInitialData="shopQuestionInitialData"
cmsWidgetName="ShopQuestionWidget" />
<contentGroupModal ref="RecalModal" cmsWidgetName="RecalModal" />
<funnel-footer
@ -147,6 +147,8 @@ export default {
zipContainsMilitaryBase: false,
selectedAppointmentType: "",
providerNumber: null,
shopQuestionInitialData: null,
selectedShop: "",
};
},
async beforeRouteEnter(to, from, next) {
@ -194,9 +196,9 @@ export default {
vm.setData(
resultMap.zipCodeData,
resultMap.serviceabilityDetails,
resultMap.mobileFeePart
resultMap.mobileFeePart,
resultMap.shopQuestionInitialData
);
vm.$refs.shopQuestion.initializeComponent(resultMap.shopQuestionInitialData);
});
},
computed: {
@ -264,15 +266,16 @@ export default {
return this.isGlassServiceableInshop;
}
},
isDualOrStaticRecalibration() {
const supportingItems = store.getters.lineItems.supportingItems;
return supportingItems.some(
(item) => item.partNumber === "RECAL STATIC" || item.partNumber === "RECAL DUAL"
// Specifically check for isRecalibrationServiceableMobile === false, not null or true.
requiresInshopRecalibration() {
return (
this.isServiceableInshop &&
this.isGlassServiceableMobile &&
this.isRecalibrationServiceableMobile === false
);
},
displayRecalibrationWarning() {
return this.isDualOrStaticRecalibration;
return this.requiresInshopRecalibration;
},
displayServiceableInshopOnly() {
return (
@ -293,6 +296,9 @@ export default {
isDropoff() {
return this.selectedAppointmentType === "Dropoff";
},
isMobile() {
return this.selectedAppointmentType === "Mobile";
},
},
methods: {
arePagePrerequisitesValid() {
@ -302,7 +308,7 @@ export default {
store.getters.payment.isInsurance !== null
);
},
setData(zipCodeData, serviceabilityDetails, mobileFeePart) {
setData(zipCodeData, serviceabilityDetails, mobileFeePart, shopQuestionInitialData) {
if (zipCodeData) {
this.zipContainsMilitaryBase = zipCodeData.containsMilitaryBase;
}
@ -314,6 +320,10 @@ export default {
if (mobileFeePart) {
this.mobileFeePart = mobileFeePart;
}
if (shopQuestionInitialData) {
this.shopQuestionInitialData = shopQuestionInitialData;
}
},
setContainsMilitaryBase(val) {
if (this.zipContainsMilitaryBase !== val) {

View file

@ -9,17 +9,19 @@
alertClass="alert-info"
v-bind:isDismissible="false" />
<buttonQuestion
ref="buttonQuestion"
buttonTypeString="shopListButton"
:buttonTypeObject="shopListButton"
class="radioQuestion"
:questionText="questionText"
:answers="answers"
groupName="ChooseShop"
groupName="chooseShop"
textPosition="text-start"
v-model="selectedValue"
isRequired
validationRules="option-required"/>
<textLink v-if="displaySeeMoreLocationsLink"
isRequired
validationRules="option-required" />
<textLink
v-if="displaySeeMoreLocationsLink"
ref="showMoreShopsLink"
class="show-more-shops-link"
id="showMoreShopsId"
@ -60,7 +62,7 @@ export default {
availability: "high",
answers: [],
shopIndex: 0,
displaySeeMoreLocationsLink: true,
displaySeeMoreLocationsLink: false,
};
},
props: {
@ -69,6 +71,10 @@ export default {
serviceZipCode: String,
selectedAppointmentType: String,
cmsWidgetName: String,
shopQuestionInitialData: {
type: Object,
required: true,
},
validationRules: String,
},
components: {
@ -101,10 +107,6 @@ export default {
serviceZipCode: this.serviceZipCode,
});
},
initializeComponent(initialData) {
this.shops = initialData;
this.getNextShopsFromList();
},
async updateShopList() {
const result = await this.dispatchStoreAction(storeActions.GET_PROVIDER_LOCATIONS, {
serviceZipCode: this.serviceZipCode,
@ -171,16 +173,29 @@ export default {
},
},
selectedAppointmentType: {
async handler() {
async handler(newValue, oldValue) {
if (oldValue == undefined) {
this.shops = this.shopQuestionInitialData;
this.getNextShopsFromList();
this.displaySeeMoreLocationsLink = true;
return;
}
await this.$nextTick();
const container = document.getElementsByClassName(
"page-container-grouped-styles"
)[0];
container.scrollTo({ top: container.scrollHeight, left: 0, behavior: "smooth" });
this.resetShopList();
this.selectedValue = "";
this.$refs.buttonQuestion.resetField();
},
immediate: true,
},
},
};