Merge branch 'develop' into feature/CSR-1115

This commit is contained in:
CarlNation 2023-05-12 10:21:34 -04:00
commit cecaf10f92
3 changed files with 53 additions and 48 deletions

View file

@ -71,7 +71,8 @@
<shopQuestion <shopQuestion
ref="shopQuestion" ref="shopQuestion"
v-show="isShopQuestionDisplayed" v-show="isShopQuestionDisplayed"
v-model="selectedProvider" v-model="selectedProviderNumber"
@providerSelected="onProviderSelected"
:serviceZipCode="zipCode" :serviceZipCode="zipCode"
:selectedAppointmentType="selectedAppointmentType" :selectedAppointmentType="selectedAppointmentType"
:isDisplayed="isShopQuestionDisplayed" :isDisplayed="isShopQuestionDisplayed"
@ -133,6 +134,14 @@ defineRule("mobile-location-required", (value) => {
return true; return true;
}); });
const defaultProvider = {
providerNumber: null,
address: null,
city: null,
state: null,
zip: null,
};
export default { export default {
name: "service-location", name: "service-location",
data() { data() {
@ -148,7 +157,8 @@ export default {
isGlassServiceableMobile: null, isGlassServiceableMobile: null,
isRecalibrationServiceableMobile: null, isRecalibrationServiceableMobile: null,
selectedAppointmentType: null, selectedAppointmentType: null,
selectedProvider: null, selectedProvider: this.getSelectedProvider(),
selectedProviderNumber: this.getSelectedProvider().providerNumber,
mobileFeePart: null, mobileFeePart: null,
zipContainsMilitaryBase: false, zipContainsMilitaryBase: false,
}; };
@ -215,7 +225,7 @@ export default {
if (newValue.zipCode !== this.zipCode) { if (newValue.zipCode !== this.zipCode) {
this.resetMobileLocation(); this.resetMobileLocation();
this.selectedAppointmentType = null; this.selectedAppointmentType = null;
this.selectedProvider = null; this.selectedProvider = defaultProvider;
} }
this.state = newValue.state; this.state = newValue.state;
@ -250,7 +260,7 @@ export default {
if (!this.selectedAppointmentType == "Mobile") { if (!this.selectedAppointmentType == "Mobile") {
this.selectedAppointmentType = null; this.selectedAppointmentType = null;
} }
this.selectedProvider = null; this.selectedProvider = defaultProvider;
} }
}, },
}, },
@ -340,6 +350,9 @@ export default {
getServiceZipCodeFromStore() { getServiceZipCodeFromStore() {
return store.getters.order.serviceLocation.zipCode; return store.getters.order.serviceLocation.zipCode;
}, },
getSelectedProvider() {
return store.getters.order.serviceLocation.provider ?? defaultProvider;
},
setMobileFeePart(mobileFeePart) { setMobileFeePart(mobileFeePart) {
this.mobileFeePart = mobileFeePart; this.mobileFeePart = mobileFeePart;
}, },
@ -373,6 +386,9 @@ export default {
async reloadShopData() { async reloadShopData() {
await this.$refs.shopQuestion.reloadShopData(this.zipCode); await this.$refs.shopQuestion.reloadShopData(this.zipCode);
}, },
onProviderSelected(selectedProvider) {
this.selectedProvider = selectedProvider;
},
}, },
components: { components: {
alert, alert,

View file

@ -157,17 +157,7 @@ describe("shop-question.vue", () => {
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
mixins: [mockMixin], mixins: [mockMixin],
props: { props: {
modelValue: { modelValue: null,
address: {
city: "POWELL",
country: "US",
state: "OH",
streetAddress: "3938 POWELL RD",
zipCode: "43065",
},
distanceInMiles: 16.2690495685233,
providerNumber: null,
},
serviceZipCode: "43081", serviceZipCode: "43081",
selectedAppointmentType: "Dropoff", selectedAppointmentType: "Dropoff",
cmsWidgetName: cmsWidgetName, cmsWidgetName: cmsWidgetName,
@ -435,41 +425,35 @@ describe("shop-question.vue", () => {
]); ]);
}); });
// it("Should display the number of shops necessary to show a previously selected shop", async () => { it("Should display the number of shops necessary to show a previously selected shop", async () => {
// // Arrange // Arrange
// const { wrapper } = setupMocks({ const selectedProvider = {
// mixins: [mockMixin], providerNumber: "003341",
// props: { };
// modelValue: {
// address: {
// city: "POWELL",
// country: "US",
// state: "OH",
// streetAddress: "3938 POWELL RD",
// zipCode: "43065",
// },
// distanceInMiles: 16.2690495685233,
// providerNumber: "003341",
// },
// serviceZipCode: "43081",
// selectedAppointmentType: "Dropoff",
// cmsWidgetName: cmsWidgetName,
// },
// mountOptions: {
// attachTo: document.body,
// },
// });
// // Act const { wrapper } = setupMocks({
// wrapper.vm.initializeComponent(shopQuestionInitialData); mixins: [mockMixin],
props: {
modelValue: selectedProvider.providerNumber,
serviceZipCode: "43081",
selectedAppointmentType: "Dropoff",
cmsWidgetName: cmsWidgetName,
},
mountOptions: {
attachTo: document.body,
},
});
// await wrapper.vm.$nextTick(); // Act
// await wrapper.vm.$nextTick(); wrapper.vm.initializeComponent(shopQuestionInitialData);
// await wrapper.vm.$nextTick();
// // Assert await wrapper.vm.$nextTick();
// expect(wrapper.vm.answers.length).toEqual(5); await wrapper.vm.$nextTick();
// }); await wrapper.vm.$nextTick();
// Assert
expect(wrapper.vm.answers.length).toEqual(5);
});
it("Should reset the answers when the selected appointment type changes", async () => { it("Should reset the answers when the selected appointment type changes", async () => {
// Arrange // Arrange

View file

@ -89,7 +89,8 @@ export default {
(provider) => provider.providerNumber == newValue (provider) => provider.providerNumber == newValue
); );
this.$emit("update:modelValue", provider); this.$emit("update:modelValue", newValue);
this.$emit("providerSelected", provider);
}, },
}, },
displayDropoffInformation() { displayDropoffInformation() {
@ -170,6 +171,10 @@ export default {
this.answers = []; this.answers = [];
this.shopIndex = 0; this.shopIndex = 0;
this.selectedValue = ""; this.selectedValue = "";
if (this.$refs.buttonQuestion) {
this.$refs.buttonQuestion.resetField();
}
}, },
async reloadShopData(serviceZipCode) { async reloadShopData(serviceZipCode) {
const result = await this.loadData(serviceZipCode); const result = await this.loadData(serviceZipCode);