Merge pull request #2406 from Safelite/feature/Digital/CASH-433

CASH-433: Hide drop-off for big trucks
This commit is contained in:
AHumphriesSL 2025-04-09 09:32:37 -04:00 committed by GitHub
commit b2e40c2dca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 63 additions and 5 deletions

View file

@ -59,7 +59,7 @@ afterEach(() => {
}); });
describe("appointment-type-question.vue", () => { describe("appointment-type-question.vue", () => {
it("Should display all options if both in-shop and mobile are available", async () => { it("Should display all options if in-shop, mobile, and dropoff are available", async () => {
// Arrange/Act // Arrange/Act
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
mixins: [mockMixin], mixins: [mockMixin],
@ -67,6 +67,7 @@ describe("appointment-type-question.vue", () => {
cmsWidgetName: cmsWidgetName, cmsWidgetName: cmsWidgetName,
isServiceableInshop: true, isServiceableInshop: true,
isServiceableMobile: true, isServiceableMobile: true,
isServiceableDropoff: true,
}, },
mountOptions: { mountOptions: {
attachTo: document.body, attachTo: document.body,
@ -99,7 +100,7 @@ describe("appointment-type-question.vue", () => {
]); ]);
}); });
it("Should display only the In-Shop and Drop-Off answers when only in-shop service is available", async () => { it("Should display only the In-Shop answer when only in-shop service is available", async () => {
// Arrange/Act // Arrange/Act
const { wrapper } = setupMocks({ const { wrapper } = setupMocks({
mixins: [mockMixin], mixins: [mockMixin],
@ -107,6 +108,34 @@ describe("appointment-type-question.vue", () => {
cmsWidgetName: cmsWidgetName, cmsWidgetName: cmsWidgetName,
isServiceableInshop: true, isServiceableInshop: true,
isServiceableMobile: false, isServiceableMobile: false,
isServiceableDropoff: false,
},
mountOptions: {
attachTo: document.body,
},
});
// Assert
expect(wrapper.vm.answersToDisplay).toEqual([
{
AnswerImageUrl: "",
Name: "Inshop",
SubText: "",
SubWidgetName: "",
Text: "In-shop",
},
]);
});
it("Should display only the In-Shop and Drop-Off answers when mobile service is not available", async () => {
// Arrange/Act
const { wrapper } = setupMocks({
mixins: [mockMixin],
props: {
cmsWidgetName: cmsWidgetName,
isServiceableInshop: true,
isServiceableMobile: false,
isServiceableDropoff: true,
}, },
mountOptions: { mountOptions: {
attachTo: document.body, attachTo: document.body,
@ -140,6 +169,7 @@ describe("appointment-type-question.vue", () => {
cmsWidgetName: cmsWidgetName, cmsWidgetName: cmsWidgetName,
isServiceableInshop: false, isServiceableInshop: false,
isServiceableMobile: true, isServiceableMobile: true,
isServiceableDropoff: false,
}, },
mountOptions: { mountOptions: {
attachTo: document.body, attachTo: document.body,
@ -172,6 +202,7 @@ describe("appointment-type-question.vue", () => {
cmsWidgetName: cmsWidgetName, cmsWidgetName: cmsWidgetName,
isServiceableInshop: true, isServiceableInshop: true,
isServiceableMobile: true, isServiceableMobile: true,
isServiceableDropoff: true,
}, },
mountOptions: { mountOptions: {
attachTo: document.body, attachTo: document.body,
@ -205,6 +236,7 @@ describe("appointment-type-question.vue", () => {
cmsWidgetName: cmsWidgetName, cmsWidgetName: cmsWidgetName,
isServiceableInshop: false, isServiceableInshop: false,
isServiceableMobile: false, isServiceableMobile: false,
isServiceableDropoff: false,
}, },
mountOptions: { mountOptions: {
attachTo: document.body, attachTo: document.body,

View file

@ -32,6 +32,7 @@ export default {
cmsWidgetName: String, cmsWidgetName: String,
isServiceableMobile: Boolean, isServiceableMobile: Boolean,
isServiceableInshop: Boolean, isServiceableInshop: Boolean,
isServiceableDropoff: Boolean,
mobileFeeApplies: Boolean, mobileFeeApplies: Boolean,
}, },
computed: { computed: {
@ -45,7 +46,7 @@ export default {
const shouldShowMobile = this.isServiceableMobile; const shouldShowMobile = this.isServiceableMobile;
const shouldShowInshop = this.isServiceableInshop; const shouldShowInshop = this.isServiceableInshop;
const shouldShowDropoff = const shouldShowDropoff =
this.isServiceableInshop && !this.$store.getters.damage.isRepair; this.isServiceableDropoff && !this.$store.getters.damage.isRepair;
var answers = this.answersFromCms var answers = this.answersFromCms
? this.answersFromCms.filter((answer) => { ? this.answersFromCms.filter((answer) => {
@ -77,6 +78,11 @@ export default {
isMobileOnly() { isMobileOnly() {
return this.isServiceableMobile && !this.isServiceableInshop; return this.isServiceableMobile && !this.isServiceableInshop;
}, },
isInshopOnly() {
return (
this.isServiceableInshop && !this.isServiceableMobile && !this.isServiceableDropoff
);
},
}, },
watch: { watch: {
answersToDisplay: { answersToDisplay: {
@ -86,7 +92,7 @@ export default {
newValue.length == 1 && newValue.length == 1 &&
newValue.findIndex((answer) => answer.Name == "Mobile") != -1 newValue.findIndex((answer) => answer.Name == "Mobile") != -1
) { ) {
this.selectedValues = "Mobile"; this.selectedValue = "Mobile";
} }
}, },
immediate: true, immediate: true,
@ -94,7 +100,14 @@ export default {
isMobileOnly: { isMobileOnly: {
handler(newValue) { handler(newValue) {
if (newValue) { if (newValue) {
this.selectedValues = "Mobile"; this.selectedValue = "Mobile";
}
},
},
isInshopOnly: {
handler(newValue) {
if (newValue) {
this.selectedValue = "Inshop";
} }
}, },
}, },

View file

@ -76,6 +76,7 @@
v-show="isAppointmentTypeDisplayed" v-show="isAppointmentTypeDisplayed"
:isServiceableMobile="isServiceableMobile" :isServiceableMobile="isServiceableMobile"
:isServiceableInshop="isServiceableInshop" :isServiceableInshop="isServiceableInshop"
:isServiceableDropoff="isServiceableDropoff"
:isDisplayed="isAppointmentTypeDisplayed" :isDisplayed="isAppointmentTypeDisplayed"
:mobileFeeApplies="mobileFeeApplies" :mobileFeeApplies="mobileFeeApplies"
ref="appointmentTypeQuestion" ref="appointmentTypeQuestion"
@ -196,6 +197,8 @@ export default {
isVehicleProtected: this.getIsVehicleProtectedFromStore(), isVehicleProtected: this.getIsVehicleProtectedFromStore(),
isGlassServiceableInshop: null, isGlassServiceableInshop: null,
isRecalibrationServiceableInshop: null, isRecalibrationServiceableInshop: null,
isGlassServiceableDropoff: null,
isRecalibrationServiceableDropoff: null,
isGlassServiceableMobile: null, isGlassServiceableMobile: null,
isRecalibrationServiceableMobile: null, isRecalibrationServiceableMobile: null,
selectedAppointmentType: this.getSelectedAppointmentType(), selectedAppointmentType: this.getSelectedAppointmentType(),
@ -354,6 +357,13 @@ export default {
return this.isGlassServiceableInshop; return this.isGlassServiceableInshop;
} }
}, },
isServiceableDropoff() {
if (this.isRecalibrationServiceableDropoff !== null) {
return this.isGlassServiceableDropoff && this.isRecalibrationServiceableDropoff;
} else {
return this.isGlassServiceableDropoff;
}
},
isShopQuestionDisplayed() { isShopQuestionDisplayed() {
return ( return (
this.selectedAppointmentType === "Inshop" || this.selectedAppointmentType === "Inshop" ||
@ -559,6 +569,9 @@ export default {
this.isGlassServiceableInshop = serviceabilityDetails.isGlassServiceableInshop; this.isGlassServiceableInshop = serviceabilityDetails.isGlassServiceableInshop;
this.isRecalibrationServiceableInshop = this.isRecalibrationServiceableInshop =
serviceabilityDetails.isRecalibrationServiceableInshop; serviceabilityDetails.isRecalibrationServiceableInshop;
this.isGlassServiceableDropoff = serviceabilityDetails.isGlassServiceableDropoff;
this.isRecalibrationServiceableDropoff =
serviceabilityDetails.isRecalibrationServiceableDropoff;
this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile; this.isGlassServiceableMobile = serviceabilityDetails.isGlassServiceableMobile;
this.isRecalibrationServiceableMobile = this.isRecalibrationServiceableMobile =
serviceabilityDetails.isRecalibrationServiceableMobile; serviceabilityDetails.isRecalibrationServiceableMobile;