changes to vehicle-questions-mixin to account for repairs
This commit is contained in:
parent
30782afadb
commit
26a0d5086b
4 changed files with 29 additions and 25 deletions
|
|
@ -122,8 +122,7 @@ const mockMixin = {
|
||||||
|
|
||||||
function setupMocks({
|
function setupMocks({
|
||||||
pageHeaderWidgetHeaderText,
|
pageHeaderWidgetHeaderText,
|
||||||
// cmsPageContent = "CMS content goes here",
|
mountOptionsMockData = {},
|
||||||
// unverifiedNonADASRepairBodyText = "repair body text",
|
|
||||||
}) {
|
}) {
|
||||||
//Mock api responses
|
//Mock api responses
|
||||||
const apiResponses = {
|
const apiResponses = {
|
||||||
|
|
@ -142,6 +141,7 @@ pageHeaderWidgetHeaderText,
|
||||||
unverifiedNonADASRepairBodyText: "Repair body text",
|
unverifiedNonADASRepairBodyText: "Repair body text",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
useMainStore().order = {
|
useMainStore().order = {
|
||||||
vehicle: {
|
vehicle: {
|
||||||
vin: "TESTVIN",
|
vin: "TESTVIN",
|
||||||
|
|
@ -171,9 +171,7 @@ pageHeaderWidgetHeaderText,
|
||||||
settleAllPromises.mockImplementation(() => apiPromise);
|
settleAllPromises.mockImplementation(() => apiPromise);
|
||||||
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
||||||
|
|
||||||
const mountOptions = getMountOptions({
|
const mountOptions = getMountOptions({});
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
mountOptions.mixins = [baseMixin, vehicleQuestionsMixin];
|
mountOptions.mixins = [baseMixin, vehicleQuestionsMixin];
|
||||||
|
|
||||||
|
|
@ -181,12 +179,6 @@ pageHeaderWidgetHeaderText,
|
||||||
|
|
||||||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||||
|
|
||||||
// //Mock CMS content
|
|
||||||
// const cmsContent = {
|
|
||||||
// PageContent: cmsPageContent,
|
|
||||||
// NonADASRepairBodyText: unverifiedNonADASRepairBodyText,
|
|
||||||
// };
|
|
||||||
|
|
||||||
return { wrapper };
|
return { wrapper };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
<siteFooter
|
<siteFooter
|
||||||
cmsWidgetName="SiteFooterWidget"
|
cmsWidgetName="SiteFooterWidget"
|
||||||
:isForwardActionDisabled="!meta.valid"
|
:isForwardActionDisabled="!meta.valid"
|
||||||
@backClicked="backButtonAction"
|
@backClicked="navigateBack"
|
||||||
@forwardClicked="forwardButtonAction"
|
@forwardClicked="forwardButtonAction"
|
||||||
ref="siteFooter" />
|
ref="siteFooter" />
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -134,16 +134,7 @@ export default {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
backButtonAction() {
|
|
||||||
if (useMainStore().order.damage.isRepair) {
|
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK_WITH_REPAIR, this.$route);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
return this.navigateForward();
|
return this.navigateForward();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -452,9 +452,15 @@ export default {
|
||||||
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||||
let backNavigationScenario = self.mainStore.vehicle.vin
|
let backNavigationScenario = "";
|
||||||
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
if (self.mainStore.order.damage.isRepair) {
|
||||||
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_REPAIR;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
backNavigationScenario = self.mainStore.vehicle.vin
|
||||||
|
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||||
|
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||||
|
}
|
||||||
|
|
||||||
const currentPage = self.$route.query.issPage;
|
const currentPage = self.$route.query.issPage;
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
|
|
@ -2080,6 +2080,21 @@ describe("vehicle-questions-mixin", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("navigateBack", () => {
|
describe("navigateBack", () => {
|
||||||
|
test("current page is coverage-statement and damage is repair => go to vehicle-damage", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({ issPage: issPageValues.COVERAGE_STATEMENT });
|
||||||
|
useMainStore().order.damage.isRepair = true;
|
||||||
|
|
||||||
|
// Act
|
||||||
|
wrapper.vm.navigateBack();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalledWith(
|
||||||
|
navigationScenarios.CLICKED_BACK_WITH_REPAIR,
|
||||||
|
{ query: { issPage: issPageValues.COVERAGE_STATEMENT } }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", () => {
|
test("current page is molding questions and there are part questions, multiple parts to choose, and capability questions => go to vehicle-parts", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ issPage: issPageValues.MOLDING_QUESTIONS });
|
const { wrapper } = setupMocks({ issPage: issPageValues.MOLDING_QUESTIONS });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue