CSR-747 Fix merge conflict
This commit is contained in:
commit
69e4d91bd3
27 changed files with 266 additions and 139 deletions
|
|
@ -27,7 +27,7 @@
|
||||||
ref="funnelFooter"
|
ref="funnelFooter"
|
||||||
cmsWidgetName="FunnelFooterWidget"
|
cmsWidgetName="FunnelFooterWidget"
|
||||||
:isForwardActionDisabled="!isMetaValid"
|
:isForwardActionDisabled="!isMetaValid"
|
||||||
@back-clicked="handleBackButtonClicked"
|
@back-clicked="handleBackButtonAction"
|
||||||
@ForwardClicked="handleForwardButtonAction" />
|
@ForwardClicked="handleForwardButtonAction" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -60,11 +60,16 @@ export default {
|
||||||
return this.getCmsContent(this.cmsWidgetName, "FooterText");
|
return this.getCmsContent(this.cmsWidgetName, "FooterText");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
methods: {
|
||||||
|
setupModalEventListener() {
|
||||||
|
const modal = document.querySelector("#" + this.cmsWidgetName);
|
||||||
|
modal.addEventListener("hidden.bs.modal", (event) => {
|
||||||
|
this.$refs.buttonMain.resetButtonStyle();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
const modal = document.querySelector("#" + this.cmsWidgetName);
|
this.setupModalEventListener();
|
||||||
modal.addEventListener("hidden.bs.modal", (event) => {
|
|
||||||
this.$refs.buttonMain.resetButtonStyle();
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
components: {
|
components: {
|
||||||
buttonMain,
|
buttonMain,
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ export default {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example returnedAnswers:
|
// returnedAnswer examples:
|
||||||
// "1|nextQuestion|3|No"
|
// "1|nextQuestion|3|No"
|
||||||
// "5|answer|DW02104|Yes"
|
// "5|answer|DW02104|Yes"
|
||||||
|
|
||||||
|
|
@ -108,15 +108,12 @@ export default {
|
||||||
const questionNum = parseInt(returnedAnswerArray[0]);
|
const questionNum = parseInt(returnedAnswerArray[0]);
|
||||||
const questionType = returnedAnswerArray[1];
|
const questionType = returnedAnswerArray[1];
|
||||||
const questionAnswer = returnedAnswerArray[2];
|
const questionAnswer = returnedAnswerArray[2];
|
||||||
const questionAnswerText = returnedAnswerArray[3];
|
|
||||||
const answeredQuestions = [];
|
const answeredQuestions = [];
|
||||||
|
|
||||||
this.questions.forEach((q) => {
|
this.questions.forEach((q) => {
|
||||||
// find this question and mark it as "answered" by populating answerSelected
|
// find this question and mark it as "answered" by populating answerSelected
|
||||||
if (q.questionSequence === questionNum) {
|
if (q.questionSequence === questionNum) {
|
||||||
q.answerSelected = returnedAnswer;
|
q.answerSelected = returnedAnswer;
|
||||||
q.answerNumber = questionNum;
|
|
||||||
q.selectedAnswerText = questionAnswerText;
|
|
||||||
}
|
}
|
||||||
// remove all answers AFTER this question...
|
// remove all answers AFTER this question...
|
||||||
// (needed in case user is changing previously answered questions)
|
// (needed in case user is changing previously answered questions)
|
||||||
|
|
@ -126,6 +123,7 @@ export default {
|
||||||
if (q.answerSelected) {
|
if (q.answerSelected) {
|
||||||
answeredQuestions.push({
|
answeredQuestions.push({
|
||||||
questionText: q.questionText,
|
questionText: q.questionText,
|
||||||
|
selectedAnswer: q.answerSelected,
|
||||||
selectedAnswerText: q.answerSelected.split("|")[3],
|
selectedAnswerText: q.answerSelected.split("|")[3],
|
||||||
questionNum: q.questionSequence,
|
questionNum: q.questionSequence,
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ describe("textboxQuestion.vue", () => {
|
||||||
expect(paragraph.attributes("class")).toContain("rounded-pill");
|
expect(paragraph.attributes("class")).toContain("rounded-pill");
|
||||||
});
|
});
|
||||||
|
|
||||||
it.only("Should return form-control class", async () => {
|
it("Should return form-control class", async () => {
|
||||||
// Act
|
// Act
|
||||||
const wrapper = shallowMount(textboxQuestion, {
|
const wrapper = shallowMount(textboxQuestion, {
|
||||||
global: {
|
global: {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ const experimentUniverses = {
|
||||||
|
|
||||||
const experimentSettings = {
|
const experimentSettings = {
|
||||||
GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index",
|
GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index",
|
||||||
|
SUPPRESS_VIN_CAPTURE: "SuppressVinCapture",
|
||||||
};
|
};
|
||||||
|
|
||||||
const experimentTriggers = {
|
const experimentTriggers = {
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,9 @@ const storeActions = {
|
||||||
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
|
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
|
||||||
SAVE_IS_INSURANCE: "saveIsInsurance",
|
SAVE_IS_INSURANCE: "saveIsInsurance",
|
||||||
SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections",
|
SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections",
|
||||||
|
SAVE_PAYMENT_TYPE: "savePaymentType",
|
||||||
|
SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
|
||||||
|
SAVE_VAPS: "saveVaps",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { storeActions };
|
export { storeActions };
|
||||||
|
|
|
||||||
|
|
@ -56,8 +56,6 @@ const storeMutations = {
|
||||||
RESET_DAMAGE_STATE: "resetDamageState",
|
RESET_DAMAGE_STATE: "resetDamageState",
|
||||||
RESET_REGISTRATION_STATE: "resetRegistrationState",
|
RESET_REGISTRATION_STATE: "resetRegistrationState",
|
||||||
RESET_GLASS_PARTS_STATE: "resetGlassPartsState",
|
RESET_GLASS_PARTS_STATE: "resetGlassPartsState",
|
||||||
RESET_SUPPORTING_ITEMS_STATE: "resetSupportingItemsState",
|
|
||||||
RESET_VAPS_STATE: "resetVapsState",
|
|
||||||
RESET_STATE: "resetState",
|
RESET_STATE: "resetState",
|
||||||
RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise",
|
RESET_SAVE_SESSION_PROMISE: "resetSaveSessionPromise",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,8 @@ import { saveSession } from "@/helpers/heritage-integration/order-helper.js";
|
||||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
import { storeActions } from "@/constants/store-actions.js";
|
import { storeActions } from "@/constants/store-actions.js";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
import experimentMixin from "@/mixins/experiment-mixin";
|
||||||
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import router from "@/router";
|
import router from "@/router";
|
||||||
|
|
||||||
|
|
@ -104,12 +106,18 @@ async function getLatestPageForRedirection() {
|
||||||
} else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) {
|
} else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) {
|
||||||
return fmgPageValues.PART_QUESTIONS;
|
return fmgPageValues.PART_QUESTIONS;
|
||||||
} else if (
|
} else if (
|
||||||
|
// capture vin
|
||||||
vinLookupComponent.methods.arePagePrerequisitesValid() &&
|
vinLookupComponent.methods.arePagePrerequisitesValid() &&
|
||||||
!store.getters.damage.isRepair &&
|
!store.getters.damage.isRepair &&
|
||||||
!isVinOptionalVehicle
|
!isVinOptionalVehicle &&
|
||||||
|
experimentMixin.methods.hasSettingEqualTo(
|
||||||
|
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||||
|
false
|
||||||
|
)
|
||||||
) {
|
) {
|
||||||
return fmgPageValues.VIN_LOOKUP;
|
return fmgPageValues.VIN_LOOKUP;
|
||||||
} else {
|
} else {
|
||||||
|
// do not capture vin
|
||||||
return fmgPageValues.ESTIMATE;
|
return fmgPageValues.ESTIMATE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,16 @@ describe("getPageToRouteExistingOrderTo", () => {
|
||||||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||||
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
store.commit(storeMutations.UPDATE_MAKE, "acura");
|
||||||
|
|
||||||
|
const mockExperimentsList = [
|
||||||
|
{
|
||||||
|
universeName: "ConceptFunnel",
|
||||||
|
settings: {
|
||||||
|
SuppressVinCapture: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
store.commit(storeMutations.UPDATE_EXPERIMENTS, mockExperimentsList);
|
||||||
|
|
||||||
// Mock out the lazy load calls for all components.
|
// Mock out the lazy load calls for all components.
|
||||||
mockLazyLoadComponentReturnValues({
|
mockLazyLoadComponentReturnValues({
|
||||||
[fmgPageValues.VEHICLE_MAKE]: true,
|
[fmgPageValues.VEHICLE_MAKE]: true,
|
||||||
|
|
|
||||||
|
|
@ -84,12 +84,14 @@ const baseStoreGettersDamage = () => {
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
||||||
|
selectedAnswer: "2|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 2,
|
questionNum: 2,
|
||||||
},
|
},
|
||||||
|
|
@ -166,10 +168,10 @@ describe("capabilityQuestions.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("watch on selectedAnswers should be set up...", () => {
|
describe("watch on selectedAnswers should be set up...", () => {
|
||||||
test("Should trigger handleAnswerUpdates if watched data changes", async () => {
|
test("Should trigger handleCompletedQuestionChainAnswers if watched data changes", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
|
|
@ -180,12 +182,14 @@ describe("capabilityQuestions.vue", () => {
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
||||||
|
selectedAnswer: "2|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 2,
|
questionNum: 2,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ export default {
|
||||||
"selectedAnswers." + glass.answerKey,
|
"selectedAnswers." + glass.answerKey,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue && Object.keys(newValue).length > 0) {
|
if (newValue && Object.keys(newValue).length > 0) {
|
||||||
this.handleAnswerUpdates(newValue, glass.answerKey);
|
this.handleCompletedQuestionChainAnswers(newValue, glass.answerKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
|
|
|
||||||
|
|
@ -221,16 +221,29 @@ describe("estimate.vue", () => {
|
||||||
|
|
||||||
describe("skipVinLookup", () => {
|
describe("skipVinLookup", () => {
|
||||||
const skipOptions = [
|
const skipOptions = [
|
||||||
[true, true, true],
|
[true, true, true, true],
|
||||||
[true, false, true],
|
[true, false, false, true],
|
||||||
[false, true, true],
|
[false, true, true, true],
|
||||||
[false, false, false],
|
[false, false, false, false],
|
||||||
];
|
];
|
||||||
test.each(skipOptions)(
|
test.each(skipOptions)(
|
||||||
"isRepair %s and isVinOptional %s should return %s",
|
"isRepair %s, isVinOptional %s and suppressVinCapture %s should return %s",
|
||||||
async (isRepair, isVinOptionalVehicle, expectedVinSkip) => {
|
async (isRepair, isVinOptionalVehicle, suppressVinCapture, expectedVinSkip) => {
|
||||||
const { wrapper } = setupMocks({ isVinOptionalVehicle: isVinOptionalVehicle });
|
const { wrapper } = setupMocks({});
|
||||||
|
await wrapper.setData({
|
||||||
|
isVinOptionalVehicle: isVinOptionalVehicle,
|
||||||
|
});
|
||||||
|
|
||||||
store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair);
|
store.commit(storeMutations.UPDATE_IS_REPAIR, isRepair);
|
||||||
|
const mockExperimentsList = [
|
||||||
|
{
|
||||||
|
universeName: "ConceptFunnel",
|
||||||
|
settings: {
|
||||||
|
SuppressVinCapture: suppressVinCapture,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
];
|
||||||
|
store.commit(storeMutations.UPDATE_EXPERIMENTS, mockExperimentsList);
|
||||||
|
|
||||||
expect(wrapper.vm.skipVinLookup).toEqual(expectedVinSkip);
|
expect(wrapper.vm.skipVinLookup).toEqual(expectedVinSkip);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -104,6 +104,9 @@ import store from "@/store";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||||
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
import experimentMixin from "@/mixins/experiment-mixin";
|
||||||
|
import { experimentSettings } from "@/constants/experiments";
|
||||||
|
import vinPagesMixin from "@/mixins/vin-pages-mixin";
|
||||||
|
|
||||||
// Define Validation Rules
|
// Define Validation Rules
|
||||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||||
|
|
@ -120,6 +123,7 @@ defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "estimate",
|
name: "estimate",
|
||||||
|
mixins: [vinPagesMixin],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedVinLookupMethod: null,
|
selectedVinLookupMethod: null,
|
||||||
|
|
@ -205,13 +209,17 @@ export default {
|
||||||
|
|
||||||
const payment = this.$store.getters.payment;
|
const payment = this.$store.getters.payment;
|
||||||
// TODO KO If coverageStatus is null, they haven't gone to heritage yet... I think
|
// TODO KO If coverageStatus is null, they haven't gone to heritage yet... I think
|
||||||
if (payment.isInsurance && payment.insuranceCoverage.coverageStatus) {
|
const vehicleChangedDuringPolicyLookupInHeritage = payment.isInsurance && payment.insuranceCoverage.coverageStatus;
|
||||||
|
if (vehicleChangedDuringPolicyLookupInHeritage) {
|
||||||
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
||||||
} else {
|
} else if (this.isRepair) {
|
||||||
return this.$router.navigateWithSaving(
|
return this.$router.navigateWithSaving(
|
||||||
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||||
this.$route
|
this.$route
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
// if we're skipping the vin-lookup but it's not a repair, we still need to get the parts
|
||||||
|
await this.navigateForwardWithSingleCarMatch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -256,10 +264,22 @@ export default {
|
||||||
return store.getters.damage.isRepair;
|
return store.getters.damage.isRepair;
|
||||||
},
|
},
|
||||||
skipVinLookup() {
|
skipVinLookup() {
|
||||||
return this.isRepair || this.isVinOptionalVehicle;
|
return (
|
||||||
|
this.isRepair ||
|
||||||
|
this.isVinOptionalVehicle ||
|
||||||
|
experimentMixin.methods.hasSettingEqualTo(
|
||||||
|
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||||
|
true
|
||||||
|
)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
alertInfo() {
|
alertInfo() {
|
||||||
return this.isVinOptionalVehicle && !this.isRepair
|
return (this.isVinOptionalVehicle ||
|
||||||
|
experimentMixin.methods.hasSettingEqualTo(
|
||||||
|
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||||
|
true
|
||||||
|
)) &&
|
||||||
|
!this.isRepair
|
||||||
? "AlertQuoteVinOptional"
|
? "AlertQuoteVinOptional"
|
||||||
: "AlertQuoteReady";
|
: "AlertQuoteReady";
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -88,12 +88,14 @@ const baseStoreGettersDamage = () => {
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
||||||
|
selectedAnswer: "2|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 2,
|
questionNum: 2,
|
||||||
},
|
},
|
||||||
|
|
@ -170,10 +172,10 @@ describe("moldingQuestions.vue", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("watch on selectedAnswers should be set up...", () => {
|
describe("watch on selectedAnswers should be set up...", () => {
|
||||||
test("Should trigger handleAnswerUpdates if watched data changes", async () => {
|
test("Should trigger handleCompletedQuestionChainAnswers if watched data changes", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
|
|
@ -184,12 +186,14 @@ describe("moldingQuestions.vue", () => {
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
||||||
|
selectedAnswer: "2|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 2,
|
questionNum: 2,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -111,7 +111,7 @@ export default {
|
||||||
"selectedAnswers." + glass.answerKey,
|
"selectedAnswers." + glass.answerKey,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue && Object.keys(newValue).length > 0) {
|
if (newValue && Object.keys(newValue).length > 0) {
|
||||||
this.handleAnswerUpdates(newValue, glass.answerKey);
|
this.handleCompletedQuestionChainAnswers(newValue, glass.answerKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,14 @@ const baseStoreGettersDamage = () => {
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
"Is your vehicle equipped with the Panoramic Sunroof which can be identified by having a glass panel over the rear seats?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
questionText:
|
questionText:
|
||||||
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
"Is your vehicle equipped with a heated windshield that melts snow and ice from underneath the windshield wiper blades?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 2,
|
questionNum: 2,
|
||||||
},
|
},
|
||||||
|
|
@ -152,14 +154,14 @@ describe("partQuestions.vue...", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("watch on selectedAnswers should be set up...", () => {
|
describe("watch on selectedAnswers should be set up...", () => {
|
||||||
test("Should trigger handleAnswerUpdates if watched data changes", async () => {
|
test("Should trigger handleCompletedQuestionChainAnswers if watched data changes", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
store.getters = {
|
store.getters = {
|
||||||
pageData: baseStoreGettersPageData,
|
pageData: baseStoreGettersPageData,
|
||||||
damage: baseStoreGettersDamage,
|
damage: baseStoreGettersDamage,
|
||||||
};
|
};
|
||||||
const { wrapper } = setupMocks({});
|
const { wrapper } = setupMocks({});
|
||||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.setData({
|
wrapper.setData({
|
||||||
|
|
@ -169,11 +171,13 @@ describe("partQuestions.vue...", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "One?",
|
questionText: "One?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
questionText: "Two?",
|
questionText: "Two?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 2,
|
questionNum: 2,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ export default {
|
||||||
"selectedAnswers." + glass.answerKey,
|
"selectedAnswers." + glass.answerKey,
|
||||||
(newValue) => {
|
(newValue) => {
|
||||||
if (newValue && Object.keys(newValue).length > 0) {
|
if (newValue && Object.keys(newValue).length > 0) {
|
||||||
this.handleAnswerUpdates(newValue, glass.answerKey);
|
this.handleCompletedQuestionChainAnswers(newValue, glass.answerKey);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ deep: true }
|
{ deep: true }
|
||||||
|
|
|
||||||
|
|
@ -23,10 +23,11 @@
|
||||||
ref="servicePackage"
|
ref="servicePackage"
|
||||||
cashCmsWidgetName="CashServicePackageQuestionWidget"
|
cashCmsWidgetName="CashServicePackageQuestionWidget"
|
||||||
insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget"
|
insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget"
|
||||||
v-model="selectedPackage"
|
|
||||||
groupName="ServicePackageQuestion"
|
groupName="ServicePackageQuestion"
|
||||||
:availableLineItems="availableLineItems"
|
:availableLineItems="availableLineItems"
|
||||||
:isInsuranceSelected="isInsuranceSelected" />
|
:isInsuranceSelected="isInsuranceSelected"
|
||||||
|
@vapsItemsSelected="vapsItemsSelectedAction" />
|
||||||
|
|
||||||
<textBlock
|
<textBlock
|
||||||
cmsWidgetName="quoteDisclaimer"
|
cmsWidgetName="quoteDisclaimer"
|
||||||
justifyText="left"
|
justifyText="left"
|
||||||
|
|
@ -173,7 +174,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
isInsuranceSelected: null,
|
isInsuranceSelected: null,
|
||||||
selectedPackage: null,
|
selectedVaps: null,
|
||||||
availableLineItems: null,
|
availableLineItems: null,
|
||||||
supportingItems: null,
|
supportingItems: null,
|
||||||
};
|
};
|
||||||
|
|
@ -184,8 +185,11 @@ export default {
|
||||||
console.log({ test });
|
console.log({ test });
|
||||||
},
|
},
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return true;
|
return (
|
||||||
//return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0);
|
store.getters.order.damage.isRepair ||
|
||||||
|
(store.getters.order.lineItems?.glassParts != null &&
|
||||||
|
store.getters.order.lineItems.glassParts.length > 0)
|
||||||
|
);
|
||||||
},
|
},
|
||||||
getDefaultIsInsuranceSelectedValue() {
|
getDefaultIsInsuranceSelectedValue() {
|
||||||
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
|
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
|
||||||
|
|
@ -197,19 +201,24 @@ export default {
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
vapsItemsSelectedAction(vapsItemsSelected) {
|
||||||
|
this.selectedVaps = vapsItemsSelected;
|
||||||
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
vehicleQuestionsMixin.methods.navigateBack(this);
|
vehicleQuestionsMixin.methods.navigateBack(this);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
forwardButtonAction() {
|
||||||
await this.dispatchStoreAction(
|
this.dispatchStoreAction(
|
||||||
this.storeActions.SAVE_QUOTE_PAGE_SELECTIONS,
|
this.storeActions.SAVE_PAYMENT_TYPE,
|
||||||
{
|
this.isInsuranceSelected,
|
||||||
isInsuranceSelected: this.isInsuranceSelected,
|
|
||||||
vapsItemsToAdd: this.selectedPackage,
|
|
||||||
supportingItemsToAdd: this.supportingItems,
|
|
||||||
},
|
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
this.dispatchStoreAction(
|
||||||
|
this.storeActions.SAVE_SUPPORTING_ITEMS,
|
||||||
|
this.supportingItems,
|
||||||
|
false
|
||||||
|
);
|
||||||
|
this.dispatchStoreAction(this.storeActions.SAVE_VAPS, this.selectedVaps, false);
|
||||||
|
|
||||||
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal });
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ describe("service-package-question.vue", () => {
|
||||||
await nextTick();
|
await nextTick();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual([
|
expect(wrapper.emitted()["vapsItemsSelected"][0][0]).toEqual([
|
||||||
{
|
{
|
||||||
description: null,
|
description: null,
|
||||||
partNumber: "RAIN DEFENSE",
|
partNumber: "RAIN DEFENSE",
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
:buttonTypeObject="servicePackageRadio"
|
:buttonTypeObject="servicePackageRadio"
|
||||||
v-model="selectedPackageName"
|
v-model="selectedPackageName"
|
||||||
isRequired />
|
isRequired />
|
||||||
|
servicePackageAnswers: {{servicePackageAnswers}} <br />
|
||||||
|
selectedPackageName: {{selectedPackageName}}
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -25,7 +27,6 @@ const packageNames = {
|
||||||
export default {
|
export default {
|
||||||
name: "servicePackageQuestion",
|
name: "servicePackageQuestion",
|
||||||
props: {
|
props: {
|
||||||
modelValue: String,
|
|
||||||
groupName: String,
|
groupName: String,
|
||||||
cashCmsWidgetName: String,
|
cashCmsWidgetName: String,
|
||||||
insuranceCmsWidgetName: String,
|
insuranceCmsWidgetName: String,
|
||||||
|
|
@ -46,7 +47,7 @@ export default {
|
||||||
},
|
},
|
||||||
selectedPackageName(newValue) {
|
selectedPackageName(newValue) {
|
||||||
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
||||||
this.$emit("update:modelValue", VapsProductsInSelectedPackage);
|
this.$emit("vapsItemsSelected", VapsProductsInSelectedPackage);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<baseInputButton v-bind="$props" @buttonClicked="handleAnswerChange" v-model="selectedValue">
|
<baseInputButton v-bind="$props" @buttonClicked="handleAnswerChange" v-model="selectedValue">
|
||||||
<div class="package-label" for="testradio">
|
<div
|
||||||
|
class="package-label"
|
||||||
|
:class="[this.buttonLabelSubCopy ? 'has-subheader' : '']"
|
||||||
|
for="testradio">
|
||||||
<div class="package-specs">
|
<div class="package-specs">
|
||||||
<p :class="[this.buttonLabelSubCopy ? 'mb-2' : 'm-0']">
|
<p class="m-0">
|
||||||
<span v-html="this.buttonLabel"></span>
|
<span v-html="this.buttonLabel"></span>
|
||||||
<span class="pricing-info" v-html="this.buttonAuxillaryCopy"></span>
|
<span class="pricing-info" v-html="this.buttonAuxillaryCopy"></span>
|
||||||
</p>
|
</p>
|
||||||
|
|
@ -113,6 +116,10 @@ export default {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
min-height: 58px;
|
min-height: 58px;
|
||||||
|
|
||||||
|
&.has-subheader {
|
||||||
|
min-height: 78px;
|
||||||
|
}
|
||||||
|
|
||||||
&:before {
|
&:before {
|
||||||
content: "";
|
content: "";
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|
@ -193,12 +200,16 @@ export default {
|
||||||
font-weight: 500;
|
font-weight: 500;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
span.pricing-info {
|
span {
|
||||||
color: $green;
|
&.pricing-info {
|
||||||
|
color: $green;
|
||||||
|
font-size: 0.875rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&.sub-label {
|
&.sub-label {
|
||||||
color: $green;
|
color: $green;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
|
font-size: 0.75rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ul {
|
ul {
|
||||||
|
|
@ -206,6 +217,7 @@ export default {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
li {
|
li {
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 0.5rem;
|
||||||
|
font-size: 0.875rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -248,7 +248,9 @@ describe("vehicle-parts.vue", () => {
|
||||||
(c) => c(wrapper.vm)
|
(c) => c(wrapper.vm)
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.vm.navigateBack();
|
store.dispatch = jest.fn(() => {});
|
||||||
|
|
||||||
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
@ -294,7 +296,8 @@ describe("vehicle-parts.vue", () => {
|
||||||
(c) => c(wrapper.vm)
|
(c) => c(wrapper.vm)
|
||||||
);
|
);
|
||||||
|
|
||||||
wrapper.vm.navigateBack();
|
store.dispatch = jest.fn(() => {});
|
||||||
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ export default {
|
||||||
|
|
||||||
return glass;
|
return glass;
|
||||||
},
|
},
|
||||||
handleAnswerUpdates(answer, glassKey, vm) {
|
handleCompletedQuestionChainAnswers(answer, glassKey, vm) {
|
||||||
// only runs when all questions in a question-chain have been answered
|
// only runs when all questions in a question-chain have been answered
|
||||||
// when selectedAnswers updates, user has completed this part's question chain and has a final answer
|
// when selectedAnswers updates, user has completed this part's question chain and has a final answer
|
||||||
// (does not get run for each invididual question's answer, only when
|
// (does not get run for each invididual question's answer, only when
|
||||||
|
|
@ -176,51 +176,39 @@ export default {
|
||||||
self.selectedAnswers = {};
|
self.selectedAnswers = {};
|
||||||
|
|
||||||
// loop through every answered question on the currently answered glass part
|
// loop through every answered question on the currently answered glass part
|
||||||
answer.answeredQuestions?.forEach((answeredQuestion) => {
|
answer.answeredQuestions?.forEach((answeredQuestion, answeredQuestionIndex) => {
|
||||||
/* answeredQuestion example format:
|
/* answeredQuestion example format:
|
||||||
{
|
{
|
||||||
"questionText": "Is your Grand Cherokee the Laredo model?",
|
"questionText": "Is your Grand Cherokee the Laredo model?",
|
||||||
|
"selectedAnswer": "1|nextQuestion|3|Yes",
|
||||||
"selectedAnswerText": "Yes",
|
"selectedAnswerText": "Yes",
|
||||||
"questionNum": 1,
|
"questionNum": 1,
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const answeredQuestionText = answeredQuestion.questionText.toUpperCase();
|
const answeredQuestionText = answeredQuestion.questionText.toUpperCase();
|
||||||
const answeredQuestionAnswer = answeredQuestion.selectedAnswerText.toUpperCase();
|
const answeredQuestionAnswer = answeredQuestion.selectedAnswer.toUpperCase();
|
||||||
|
const answeredQuestionAnswerText =
|
||||||
|
answeredQuestion.selectedAnswerText.toUpperCase();
|
||||||
|
const answeredQuestionNum = answeredQuestion.questionNum;
|
||||||
|
|
||||||
// HANDLE DUPLICATE QUESTIONS
|
// HANDLE DUPLICATE QUESTIONS
|
||||||
|
|
||||||
// loop through all glass data
|
// loop through all glass data
|
||||||
self.questionsData.forEach((glass, glassIndex) => {
|
self.questionsData.forEach((glass, glassIndex) => {
|
||||||
/* glass example format:
|
if (glassIndex === answer.index) {
|
||||||
{
|
glass.questions.forEach((question, questionIndex) => {
|
||||||
"glassName": "Single",
|
// clear out any previously set answers on first pass with first answered question
|
||||||
"glassLocation": "Windshield",
|
if (answeredQuestionIndex === 0) question.answerSelected = null;
|
||||||
"parts": null,
|
|
||||||
"questions": [
|
|
||||||
{
|
|
||||||
"questionSequence": 1,
|
|
||||||
"questionText": "Is your vehicle equipped with a black dotted pattern behind the rear view mirror, known as a third visor frit?",
|
|
||||||
"answers": [
|
|
||||||
{
|
|
||||||
"answerResult": "DW01537",
|
|
||||||
"answerText": "Yes",
|
|
||||||
"nextQuestionSequence": null
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"answerResult": "DW01537b",
|
|
||||||
"answerText": "No",
|
|
||||||
"nextQuestionSequence": null
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"answerKey": "Windshield-Single",
|
|
||||||
"answerData": null
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
// limit duplicate search to glass pieces that follow after the currently being answered glass piece
|
if (answeredQuestionNum - 1 === questionIndex) {
|
||||||
|
// on the right question
|
||||||
|
question.answerSelected = answeredQuestionAnswer;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// limit duplicate search to glass pieces that are in or follow after the currently being answered glass piece
|
||||||
if (glassIndex > answer.index) {
|
if (glassIndex > answer.index) {
|
||||||
let indexToSuppressTo;
|
let indexToSuppressTo;
|
||||||
// reset this glass piece, in case user is changing their previous answers
|
// reset this glass piece, in case user is changing their previous answers
|
||||||
|
|
@ -229,8 +217,8 @@ export default {
|
||||||
|
|
||||||
// loop through this glass piece's questions, looking for a questionText match
|
// loop through this glass piece's questions, looking for a questionText match
|
||||||
glass.questions.forEach((question, questionIndex) => {
|
glass.questions.forEach((question, questionIndex) => {
|
||||||
// clear out any previously set answers
|
// clear out any previously set answers on first pass with first answer
|
||||||
question.answerSelected = null;
|
if (answeredQuestionIndex === 0) question.answerSelected = null;
|
||||||
|
|
||||||
// clear or set suppressThisQuestion property for each question
|
// clear or set suppressThisQuestion property for each question
|
||||||
if (indexToSuppressTo && questionIndex + 1 < indexToSuppressTo) {
|
if (indexToSuppressTo && questionIndex + 1 < indexToSuppressTo) {
|
||||||
|
|
@ -245,7 +233,9 @@ export default {
|
||||||
|
|
||||||
// handle matching answer in duplicated question
|
// handle matching answer in duplicated question
|
||||||
question.answers.forEach((ans) => {
|
question.answers.forEach((ans) => {
|
||||||
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
|
if (
|
||||||
|
ans.answerText.toUpperCase() === answeredQuestionAnswerText
|
||||||
|
) {
|
||||||
matchedAnswer = ans;
|
matchedAnswer = ans;
|
||||||
ans.selected = true;
|
ans.selected = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -339,7 +329,7 @@ export default {
|
||||||
glass.isSuppressedPart = true;
|
glass.isSuppressedPart = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
}); // DONE looping through glass.questions
|
||||||
|
|
||||||
// Update key to force re-render of glass piece with duplicate question in case user changes previous related answer in the chain
|
// Update key to force re-render of glass piece with duplicate question in case user changes previous related answer in the chain
|
||||||
self.questionsData[glassIndex].key =
|
self.questionsData[glassIndex].key =
|
||||||
|
|
@ -473,7 +463,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Can't use `this` because navigateForward is also called from quote
|
// Can't use `this` because navigateForward is also called from quote
|
||||||
navigateBack(vm) {
|
async navigateBack(vm) {
|
||||||
const self = vm ?? this;
|
const self = vm ?? this;
|
||||||
const partsOrQuestions = (
|
const partsOrQuestions = (
|
||||||
self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ??
|
self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ??
|
||||||
|
|
@ -486,6 +476,8 @@ 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);
|
||||||
|
const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
|
||||||
|
|
||||||
let backNavigationScenario = self.$store.getters.vehicle.vin
|
let backNavigationScenario = self.$store.getters.vehicle.vin
|
||||||
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||||
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||||
|
|
@ -512,6 +504,8 @@ export default {
|
||||||
this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS)
|
this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS)
|
||||||
) {
|
) {
|
||||||
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS;
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS;
|
||||||
|
} else if (skipVinLookup) {
|
||||||
|
backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.$router.navigateWithoutSaving(backNavigationScenario, self.$route);
|
self.$router.navigateWithoutSaving(backNavigationScenario, self.$route);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ import { shallowMount } from "@vue/test-utils";
|
||||||
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
|
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
import { storeMutations } from "@/constants/store-mutations";
|
import { storeMutations } from "@/constants/store-mutations";
|
||||||
|
import store from "@/store";
|
||||||
import { storeActions } from "@/constants/store-actions";
|
import { storeActions } from "@/constants/store-actions";
|
||||||
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
||||||
import { getters } from "@/store";
|
import { getters } from "@/store";
|
||||||
|
|
@ -410,7 +411,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("handleAnswerUpdates", () => {
|
describe("handleCompletedQuestionChainAnswers", () => {
|
||||||
describe("selectedAnswers", () => {
|
describe("selectedAnswers", () => {
|
||||||
test("should be cleared to be empty", () => {
|
test("should be cleared to be empty", () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -419,6 +420,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -438,7 +440,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.selectedAnswers).toMatchObject({});
|
expect(wrapper.vm.selectedAnswers).toMatchObject({});
|
||||||
|
|
@ -453,6 +455,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -477,7 +480,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.questionsData[1].answerData).toEqual(null);
|
expect(wrapper.vm.questionsData[1].answerData).toEqual(null);
|
||||||
|
|
@ -489,6 +492,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -514,7 +518,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.questionsData[1].isSuppressedPart).toEqual(null);
|
expect(wrapper.vm.questionsData[1].isSuppressedPart).toEqual(null);
|
||||||
|
|
@ -526,6 +530,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||||
selectedAnswerText: "Yes",
|
selectedAnswerText: "Yes",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -587,7 +592,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.questionsData[1].questions[0].answerSelected).toEqual(null);
|
expect(wrapper.vm.questionsData[1].questions[0].answerSelected).toEqual(null);
|
||||||
|
|
@ -603,6 +608,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|No",
|
||||||
selectedAnswerText: "No",
|
selectedAnswerText: "No",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -661,7 +667,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||||
const glassWithDuplicate = wrapper.vm.questionsData[1];
|
const glassWithDuplicate = wrapper.vm.questionsData[1];
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -675,6 +681,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|No",
|
||||||
selectedAnswerText: "No",
|
selectedAnswerText: "No",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -731,7 +738,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||||
const duplicateQuestion = wrapper.vm.questionsData[1].questions[0];
|
const duplicateQuestion = wrapper.vm.questionsData[1].questions[0];
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -746,6 +753,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|No",
|
||||||
selectedAnswerText: "No",
|
selectedAnswerText: "No",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -835,7 +843,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||||
const nextQuestionAfterDuplicate = wrapper.vm.questionsData[1].questions[2];
|
const nextQuestionAfterDuplicate = wrapper.vm.questionsData[1].questions[2];
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
|
|
@ -849,6 +857,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test question 3?",
|
questionText: "Test question 3?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|No",
|
||||||
selectedAnswerText: "No",
|
selectedAnswerText: "No",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -969,7 +978,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||||
const duplicatedQuestion = wrapper.vm.questionsData[1].questions[2];
|
const duplicatedQuestion = wrapper.vm.questionsData[1].questions[2];
|
||||||
const duplicatedQuestionAnswer = duplicatedQuestion.answers.filter((a) => {
|
const duplicatedQuestionAnswer = duplicatedQuestion.answers.filter((a) => {
|
||||||
return a.selected;
|
return a.selected;
|
||||||
|
|
@ -997,6 +1006,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test duplicate question 1?",
|
questionText: "Test duplicate question 1?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|No",
|
||||||
selectedAnswerText: "No",
|
selectedAnswerText: "No",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -1085,7 +1095,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(
|
expect(
|
||||||
|
|
@ -1109,6 +1119,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
answeredQuestions: [
|
answeredQuestions: [
|
||||||
{
|
{
|
||||||
questionText: "Test question 3?",
|
questionText: "Test question 3?",
|
||||||
|
selectedAnswer: "1|nextQuestion|3|No",
|
||||||
selectedAnswerText: "No",
|
selectedAnswerText: "No",
|
||||||
questionNum: 1,
|
questionNum: 1,
|
||||||
},
|
},
|
||||||
|
|
@ -1197,7 +1208,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
];
|
];
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
await wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
await wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||||
|
|
||||||
const questionsToTest = wrapper.vm.questionsData[1].questions;
|
const questionsToTest = wrapper.vm.questionsData[1].questions;
|
||||||
const answerLeadingToDuplicate = questionsToTest[0].answers[1];
|
const answerLeadingToDuplicate = questionsToTest[0].answers[1];
|
||||||
|
|
@ -2249,12 +2260,13 @@ describe("vehicle-questions-mixin", () => {
|
||||||
"current page is quote, there are no questions, and we don't have their vin => go to estimate"
|
"current page is quote, there are no questions, and we don't have their vin => go to estimate"
|
||||||
);
|
);
|
||||||
|
|
||||||
test("current page is quote, there are no questions, and we have their vin => go to vin-lookup", () => {
|
test("current page is quote, there are no questions, and we have their vin => go to vin-lookup", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true });
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true });
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.navigateBack();
|
store.dispatch = jest.fn(() => {});
|
||||||
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
@ -2263,13 +2275,14 @@ describe("vehicle-questions-mixin", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("current page is quote and there are capability questions => go to capability questions", () => {
|
test("current page is quote and there are capability questions => go to capability questions", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.navigateBack();
|
store.dispatch = jest.fn(() => {});
|
||||||
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
@ -2278,14 +2291,14 @@ describe("vehicle-questions-mixin", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("current page is quote and there are part questions and molding questions => go to molding questions", () => {
|
test("current page is quote and there are part questions and molding questions => go to molding questions", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.navigateBack();
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
@ -2294,7 +2307,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
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", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
@ -2303,7 +2316,8 @@ describe("vehicle-questions-mixin", () => {
|
||||||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.navigateBack();
|
store.dispatch = jest.fn(() => {});
|
||||||
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
@ -2312,7 +2326,7 @@ describe("vehicle-questions-mixin", () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test("current page is molding questions and there are part questions and capability questions => go to part-questions", () => {
|
test("current page is molding questions and there are part questions and capability questions => go to part-questions", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
@ -2321,7 +2335,8 @@ describe("vehicle-questions-mixin", () => {
|
||||||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
wrapper.vm.navigateBack();
|
store.dispatch = jest.fn(() => {});
|
||||||
|
await wrapper.vm.navigateBack();
|
||||||
|
|
||||||
// Assert
|
// Assert
|
||||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ const navigationScenarios = {
|
||||||
CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS",
|
CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS",
|
||||||
CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS",
|
CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS",
|
||||||
CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS",
|
CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS",
|
||||||
|
CLICKED_BACK_TO_GO_TO_ESTIMATE: "CLICKED_BACK_TO_GO_TO_ESTIMATE",
|
||||||
};
|
};
|
||||||
|
|
||||||
export { navigationScenarios };
|
export { navigationScenarios };
|
||||||
|
|
|
||||||
|
|
@ -251,6 +251,22 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_PART_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MULTIPLE_PARTS_TO_CHOOSE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_MOLDING_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.MOLDING_QUESTIONS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_CAPABILITY_QUESTIONS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -280,6 +296,10 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -313,6 +333,10 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -342,6 +366,10 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -371,6 +399,10 @@ const routingTable = function (store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE,
|
||||||
|
destinationFmgPageValue: fmgPageValues.ESTIMATE,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -298,12 +298,6 @@ export const mutations = {
|
||||||
state.applicationUser.pageData[fmgPageValues.MOLDING_QUESTIONS] = null;
|
state.applicationUser.pageData[fmgPageValues.MOLDING_QUESTIONS] = null;
|
||||||
state.applicationUser.pageData[fmgPageValues.CAPABILITY_QUESTIONS] = null;
|
state.applicationUser.pageData[fmgPageValues.CAPABILITY_QUESTIONS] = null;
|
||||||
},
|
},
|
||||||
resetSupportingItemsState(state) {
|
|
||||||
state.order.lineItems.supportingItems = null;
|
|
||||||
},
|
|
||||||
resetVapsState(state) {
|
|
||||||
state.order.lineItems.vaps = null;
|
|
||||||
},
|
|
||||||
resetState(state) {
|
resetState(state) {
|
||||||
Object.assign(state, getDefaultState());
|
Object.assign(state, getDefaultState());
|
||||||
},
|
},
|
||||||
|
|
@ -589,19 +583,17 @@ export const actions = {
|
||||||
resetDamageAndDependencies(context) {
|
resetDamageAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
context.commit(storeMutations.UPDATE_VAPS, null);
|
||||||
},
|
},
|
||||||
resetRegistrationAndDependencies(context) {
|
resetRegistrationAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
|
||||||
},
|
},
|
||||||
resetPartsAndDependencies(context) {
|
resetPartsAndDependencies(context) {
|
||||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
|
||||||
},
|
},
|
||||||
resetState(context) {
|
resetState(context) {
|
||||||
context.commit(storeMutations.RESET_STATE);
|
context.commit(storeMutations.RESET_STATE);
|
||||||
|
|
@ -1286,6 +1278,7 @@ export const actions = {
|
||||||
if (isDamageChanging) {
|
if (isDamageChanging) {
|
||||||
//Reset dependent state when changing
|
//Reset dependent state when changing
|
||||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||||
|
context.commit(storeMutations.UPDATE_VAPS, null);
|
||||||
|
|
||||||
// Save new values
|
// Save new values
|
||||||
context.commit(storeMutations.UPDATE_IS_REPAIR, isWindshieldRepair);
|
context.commit(storeMutations.UPDATE_IS_REPAIR, isWindshieldRepair);
|
||||||
|
|
@ -1377,7 +1370,7 @@ export const actions = {
|
||||||
|
|
||||||
if (havePartQuestionAnswersChanged) {
|
if (havePartQuestionAnswersChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
||||||
|
|
@ -1423,7 +1416,7 @@ export const actions = {
|
||||||
|
|
||||||
if (haveSelectedVehiclePartsChanged) {
|
if (haveSelectedVehiclePartsChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_MOLDING_QUESTION_ANSWERS, null);
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
||||||
|
|
@ -1453,7 +1446,7 @@ export const actions = {
|
||||||
|
|
||||||
if (haveMoldingQuestionAnswersChanged) {
|
if (haveMoldingQuestionAnswersChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
context.commit(storeMutations.UPDATE_CAPABILITY_QUESTION_ANSWERS, null);
|
||||||
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
||||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||||
|
|
@ -1481,7 +1474,7 @@ export const actions = {
|
||||||
|
|
||||||
if (haveCapabilityQuestionAnswersChanged) {
|
if (haveCapabilityQuestionAnswersChanged) {
|
||||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Save new values
|
//Save new values
|
||||||
|
|
@ -1490,16 +1483,14 @@ export const actions = {
|
||||||
capabilityQuestionAnswers
|
capabilityQuestionAnswers
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
// Quote Page
|
savePaymentType(context, isInsurance) {
|
||||||
saveQuotePageSelections(
|
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsurance);
|
||||||
context,
|
},
|
||||||
{ isInsuranceSelected, vapsItemsToAdd, supportingItemsToAdd }
|
saveSupportingItems(context, supportingItems) {
|
||||||
) {
|
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
||||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
},
|
||||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
saveVaps(context, vaps) {
|
||||||
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsuranceSelected);
|
context.commit(storeMutations.UPDATE_VAPS, vaps);
|
||||||
context.commit(storeMutations.UPDATE_VAPS, vapsItemsToAdd);
|
|
||||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItemsToAdd);
|
|
||||||
},
|
},
|
||||||
// Price order actions
|
// Price order actions
|
||||||
// PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED
|
// PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED
|
||||||
|
|
@ -1550,8 +1541,9 @@ export const actions = {
|
||||||
if (
|
if (
|
||||||
context.state.order.vehicle.make.toLowerCase() === "ford" &&
|
context.state.order.vehicle.make.toLowerCase() === "ford" &&
|
||||||
context.state.order.vehicle.year >= 2018
|
context.state.order.vehicle.year >= 2018
|
||||||
)
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
context.state.order.vehicle.make.toLowerCase() === "bmw" &&
|
context.state.order.vehicle.make.toLowerCase() === "bmw" &&
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue