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({
|
||||
pageHeaderWidgetHeaderText,
|
||||
// cmsPageContent = "CMS content goes here",
|
||||
// unverifiedNonADASRepairBodyText = "repair body text",
|
||||
mountOptionsMockData = {},
|
||||
}) {
|
||||
//Mock api responses
|
||||
const apiResponses = {
|
||||
|
|
@ -142,6 +141,7 @@ pageHeaderWidgetHeaderText,
|
|||
unverifiedNonADASRepairBodyText: "Repair body text",
|
||||
},
|
||||
};
|
||||
|
||||
useMainStore().order = {
|
||||
vehicle: {
|
||||
vin: "TESTVIN",
|
||||
|
|
@ -171,9 +171,7 @@ pageHeaderWidgetHeaderText,
|
|||
settleAllPromises.mockImplementation(() => apiPromise);
|
||||
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
|
||||
|
||||
const mountOptions = getMountOptions({
|
||||
|
||||
});
|
||||
const mountOptions = getMountOptions({});
|
||||
|
||||
mountOptions.mixins = [baseMixin, vehicleQuestionsMixin];
|
||||
|
||||
|
|
@ -181,12 +179,6 @@ pageHeaderWidgetHeaderText,
|
|||
|
||||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||
|
||||
// //Mock CMS content
|
||||
// const cmsContent = {
|
||||
// PageContent: cmsPageContent,
|
||||
// NonADASRepairBodyText: unverifiedNonADASRepairBodyText,
|
||||
// };
|
||||
|
||||
return { wrapper };
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@
|
|||
<siteFooter
|
||||
cmsWidgetName="SiteFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
@backClicked="backButtonAction"
|
||||
@backClicked="navigateBack"
|
||||
@forwardClicked="forwardButtonAction"
|
||||
ref="siteFooter" />
|
||||
</div>
|
||||
|
|
@ -134,16 +134,7 @@ export default {
|
|||
}
|
||||
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() {
|
||||
return this.navigateForward();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -452,9 +452,15 @@ export default {
|
|||
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||
let backNavigationScenario = self.mainStore.vehicle.vin
|
||||
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||
let backNavigationScenario = "";
|
||||
if (self.mainStore.order.damage.isRepair) {
|
||||
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;
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -2080,6 +2080,21 @@ describe("vehicle-questions-mixin", () => {
|
|||
});
|
||||
|
||||
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", () => {
|
||||
// Arrange
|
||||
const { wrapper } = setupMocks({ issPage: issPageValues.MOLDING_QUESTIONS });
|
||||
|
|
|
|||
Loading…
Reference in a new issue