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"
|
||||
cmsWidgetName="FunnelFooterWidget"
|
||||
:isForwardActionDisabled="!isMetaValid"
|
||||
@back-clicked="handleBackButtonClicked"
|
||||
@back-clicked="handleBackButtonAction"
|
||||
@ForwardClicked="handleForwardButtonAction" />
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -60,11 +60,16 @@ export default {
|
|||
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() {
|
||||
const modal = document.querySelector("#" + this.cmsWidgetName);
|
||||
modal.addEventListener("hidden.bs.modal", (event) => {
|
||||
this.$refs.buttonMain.resetButtonStyle();
|
||||
});
|
||||
this.setupModalEventListener();
|
||||
},
|
||||
components: {
|
||||
buttonMain,
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ export default {
|
|||
return false;
|
||||
}
|
||||
|
||||
// Example returnedAnswers:
|
||||
// returnedAnswer examples:
|
||||
// "1|nextQuestion|3|No"
|
||||
// "5|answer|DW02104|Yes"
|
||||
|
||||
|
|
@ -108,15 +108,12 @@ export default {
|
|||
const questionNum = parseInt(returnedAnswerArray[0]);
|
||||
const questionType = returnedAnswerArray[1];
|
||||
const questionAnswer = returnedAnswerArray[2];
|
||||
const questionAnswerText = returnedAnswerArray[3];
|
||||
const answeredQuestions = [];
|
||||
|
||||
this.questions.forEach((q) => {
|
||||
// find this question and mark it as "answered" by populating answerSelected
|
||||
if (q.questionSequence === questionNum) {
|
||||
q.answerSelected = returnedAnswer;
|
||||
q.answerNumber = questionNum;
|
||||
q.selectedAnswerText = questionAnswerText;
|
||||
}
|
||||
// remove all answers AFTER this question...
|
||||
// (needed in case user is changing previously answered questions)
|
||||
|
|
@ -126,6 +123,7 @@ export default {
|
|||
if (q.answerSelected) {
|
||||
answeredQuestions.push({
|
||||
questionText: q.questionText,
|
||||
selectedAnswer: q.answerSelected,
|
||||
selectedAnswerText: q.answerSelected.split("|")[3],
|
||||
questionNum: q.questionSequence,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ describe("textboxQuestion.vue", () => {
|
|||
expect(paragraph.attributes("class")).toContain("rounded-pill");
|
||||
});
|
||||
|
||||
it.only("Should return form-control class", async () => {
|
||||
it("Should return form-control class", async () => {
|
||||
// Act
|
||||
const wrapper = shallowMount(textboxQuestion, {
|
||||
global: {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ const experimentUniverses = {
|
|||
|
||||
const experimentSettings = {
|
||||
GOOGLE_CUSTOM_DIMENSION_INDEX: "Google Custom Dimension Index",
|
||||
SUPPRESS_VIN_CAPTURE: "SuppressVinCapture",
|
||||
};
|
||||
|
||||
const experimentTriggers = {
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ const storeActions = {
|
|||
SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers",
|
||||
SAVE_IS_INSURANCE: "saveIsInsurance",
|
||||
SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections",
|
||||
SAVE_PAYMENT_TYPE: "savePaymentType",
|
||||
SAVE_SUPPORTING_ITEMS: "saveSupportingItems",
|
||||
SAVE_VAPS: "saveVaps",
|
||||
};
|
||||
|
||||
export { storeActions };
|
||||
|
|
|
|||
|
|
@ -56,8 +56,6 @@ const storeMutations = {
|
|||
RESET_DAMAGE_STATE: "resetDamageState",
|
||||
RESET_REGISTRATION_STATE: "resetRegistrationState",
|
||||
RESET_GLASS_PARTS_STATE: "resetGlassPartsState",
|
||||
RESET_SUPPORTING_ITEMS_STATE: "resetSupportingItemsState",
|
||||
RESET_VAPS_STATE: "resetVapsState",
|
||||
RESET_STATE: "resetState",
|
||||
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 { storeActions } from "@/constants/store-actions.js";
|
||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||
import experimentMixin from "@/mixins/experiment-mixin";
|
||||
import { experimentSettings } from "@/constants/experiments";
|
||||
import store from "@/store";
|
||||
import router from "@/router";
|
||||
|
||||
|
|
@ -104,12 +106,18 @@ async function getLatestPageForRedirection() {
|
|||
} else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) {
|
||||
return fmgPageValues.PART_QUESTIONS;
|
||||
} else if (
|
||||
// capture vin
|
||||
vinLookupComponent.methods.arePagePrerequisitesValid() &&
|
||||
!store.getters.damage.isRepair &&
|
||||
!isVinOptionalVehicle
|
||||
!isVinOptionalVehicle &&
|
||||
experimentMixin.methods.hasSettingEqualTo(
|
||||
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||
false
|
||||
)
|
||||
) {
|
||||
return fmgPageValues.VIN_LOOKUP;
|
||||
} else {
|
||||
// do not capture vin
|
||||
return fmgPageValues.ESTIMATE;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,6 +144,16 @@ describe("getPageToRouteExistingOrderTo", () => {
|
|||
store.commit(storeMutations.UPDATE_IS_REPAIR, false);
|
||||
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.
|
||||
mockLazyLoadComponentReturnValues({
|
||||
[fmgPageValues.VEHICLE_MAKE]: true,
|
||||
|
|
|
|||
|
|
@ -84,12 +84,14 @@ const baseStoreGettersDamage = () => {
|
|||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 1,
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 2,
|
||||
},
|
||||
|
|
@ -166,10 +168,10 @@ describe("capabilityQuestions.vue", () => {
|
|||
});
|
||||
|
||||
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
|
||||
const { wrapper } = setupMocks({});
|
||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
||||
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||
|
||||
// Act
|
||||
wrapper.setData({
|
||||
|
|
@ -180,12 +182,14 @@ describe("capabilityQuestions.vue", () => {
|
|||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 1,
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 2,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ export default {
|
|||
"selectedAnswers." + glass.answerKey,
|
||||
(newValue) => {
|
||||
if (newValue && Object.keys(newValue).length > 0) {
|
||||
this.handleAnswerUpdates(newValue, glass.answerKey);
|
||||
this.handleCompletedQuestionChainAnswers(newValue, glass.answerKey);
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
|
|
|
|||
|
|
@ -221,16 +221,29 @@ describe("estimate.vue", () => {
|
|||
|
||||
describe("skipVinLookup", () => {
|
||||
const skipOptions = [
|
||||
[true, true, true],
|
||||
[true, false, true],
|
||||
[false, true, true],
|
||||
[false, false, false],
|
||||
[true, true, true, true],
|
||||
[true, false, false, true],
|
||||
[false, true, true, true],
|
||||
[false, false, false, false],
|
||||
];
|
||||
test.each(skipOptions)(
|
||||
"isRepair %s and isVinOptional %s should return %s",
|
||||
async (isRepair, isVinOptionalVehicle, expectedVinSkip) => {
|
||||
const { wrapper } = setupMocks({ isVinOptionalVehicle: isVinOptionalVehicle });
|
||||
"isRepair %s, isVinOptional %s and suppressVinCapture %s should return %s",
|
||||
async (isRepair, isVinOptionalVehicle, suppressVinCapture, expectedVinSkip) => {
|
||||
const { wrapper } = setupMocks({});
|
||||
await wrapper.setData({
|
||||
isVinOptionalVehicle: isVinOptionalVehicle,
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -104,6 +104,9 @@ import store from "@/store";
|
|||
import { storeActions } from "@/constants/store-actions";
|
||||
import { vinLookupMethodSelections } from "@/constants/vin-lookup-method-selections.js";
|
||||
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
|
||||
defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
|
||||
|
|
@ -120,6 +123,7 @@ defineRule("option-required", required(errorMessages.OPTION_REQUIRED));
|
|||
|
||||
export default {
|
||||
name: "estimate",
|
||||
mixins: [vinPagesMixin],
|
||||
data() {
|
||||
return {
|
||||
selectedVinLookupMethod: null,
|
||||
|
|
@ -205,13 +209,17 @@ export default {
|
|||
|
||||
const payment = this.$store.getters.payment;
|
||||
// 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 });
|
||||
} else {
|
||||
} else if (this.isRepair) {
|
||||
return this.$router.navigateWithSaving(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||
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;
|
||||
},
|
||||
skipVinLookup() {
|
||||
return this.isRepair || this.isVinOptionalVehicle;
|
||||
return (
|
||||
this.isRepair ||
|
||||
this.isVinOptionalVehicle ||
|
||||
experimentMixin.methods.hasSettingEqualTo(
|
||||
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||
true
|
||||
)
|
||||
);
|
||||
},
|
||||
alertInfo() {
|
||||
return this.isVinOptionalVehicle && !this.isRepair
|
||||
return (this.isVinOptionalVehicle ||
|
||||
experimentMixin.methods.hasSettingEqualTo(
|
||||
experimentSettings.SUPPRESS_VIN_CAPTURE,
|
||||
true
|
||||
)) &&
|
||||
!this.isRepair
|
||||
? "AlertQuoteVinOptional"
|
||||
: "AlertQuoteReady";
|
||||
},
|
||||
|
|
|
|||
|
|
@ -88,12 +88,14 @@ const baseStoreGettersDamage = () => {
|
|||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 1,
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 2,
|
||||
},
|
||||
|
|
@ -170,10 +172,10 @@ describe("moldingQuestions.vue", () => {
|
|||
});
|
||||
|
||||
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
|
||||
const { wrapper } = setupMocks({});
|
||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
||||
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||
|
||||
// Act
|
||||
wrapper.setData({
|
||||
|
|
@ -184,12 +186,14 @@ describe("moldingQuestions.vue", () => {
|
|||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 1,
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 2,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ export default {
|
|||
"selectedAnswers." + glass.answerKey,
|
||||
(newValue) => {
|
||||
if (newValue && Object.keys(newValue).length > 0) {
|
||||
this.handleAnswerUpdates(newValue, glass.answerKey);
|
||||
this.handleCompletedQuestionChainAnswers(newValue, glass.answerKey);
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
|
|
|
|||
|
|
@ -78,12 +78,14 @@ const baseStoreGettersDamage = () => {
|
|||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 1,
|
||||
},
|
||||
{
|
||||
questionText:
|
||||
"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",
|
||||
questionNum: 2,
|
||||
},
|
||||
|
|
@ -152,14 +154,14 @@ describe("partQuestions.vue...", () => {
|
|||
});
|
||||
|
||||
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
|
||||
store.getters = {
|
||||
pageData: baseStoreGettersPageData,
|
||||
damage: baseStoreGettersDamage,
|
||||
};
|
||||
const { wrapper } = setupMocks({});
|
||||
const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates");
|
||||
const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers");
|
||||
|
||||
// Act
|
||||
wrapper.setData({
|
||||
|
|
@ -169,11 +171,13 @@ describe("partQuestions.vue...", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "One?",
|
||||
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||
selectedAnswerText: "Yes",
|
||||
questionNum: 1,
|
||||
},
|
||||
{
|
||||
questionText: "Two?",
|
||||
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||
selectedAnswerText: "Yes",
|
||||
questionNum: 2,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ export default {
|
|||
"selectedAnswers." + glass.answerKey,
|
||||
(newValue) => {
|
||||
if (newValue && Object.keys(newValue).length > 0) {
|
||||
this.handleAnswerUpdates(newValue, glass.answerKey);
|
||||
this.handleCompletedQuestionChainAnswers(newValue, glass.answerKey);
|
||||
}
|
||||
},
|
||||
{ deep: true }
|
||||
|
|
|
|||
|
|
@ -23,10 +23,11 @@
|
|||
ref="servicePackage"
|
||||
cashCmsWidgetName="CashServicePackageQuestionWidget"
|
||||
insuranceCmsWidgetName="InsuranceServicePackageQuestionWidget"
|
||||
v-model="selectedPackage"
|
||||
groupName="ServicePackageQuestion"
|
||||
:availableLineItems="availableLineItems"
|
||||
:isInsuranceSelected="isInsuranceSelected" />
|
||||
:isInsuranceSelected="isInsuranceSelected"
|
||||
@vapsItemsSelected="vapsItemsSelectedAction" />
|
||||
|
||||
<textBlock
|
||||
cmsWidgetName="quoteDisclaimer"
|
||||
justifyText="left"
|
||||
|
|
@ -173,7 +174,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
isInsuranceSelected: null,
|
||||
selectedPackage: null,
|
||||
selectedVaps: null,
|
||||
availableLineItems: null,
|
||||
supportingItems: null,
|
||||
};
|
||||
|
|
@ -184,8 +185,11 @@ export default {
|
|||
console.log({ test });
|
||||
},
|
||||
arePagePrerequisitesValid() {
|
||||
return true;
|
||||
//return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0);
|
||||
return (
|
||||
store.getters.order.damage.isRepair ||
|
||||
(store.getters.order.lineItems?.glassParts != null &&
|
||||
store.getters.order.lineItems.glassParts.length > 0)
|
||||
);
|
||||
},
|
||||
getDefaultIsInsuranceSelectedValue() {
|
||||
const defaultIsInsuranceSelectedValue = this.$store.getters.order.payment.isInsurance;
|
||||
|
|
@ -197,19 +201,24 @@ export default {
|
|||
: null;
|
||||
}
|
||||
},
|
||||
vapsItemsSelectedAction(vapsItemsSelected) {
|
||||
this.selectedVaps = vapsItemsSelected;
|
||||
},
|
||||
backButtonAction() {
|
||||
vehicleQuestionsMixin.methods.navigateBack(this);
|
||||
},
|
||||
async forwardButtonAction() {
|
||||
await this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_QUOTE_PAGE_SELECTIONS,
|
||||
{
|
||||
isInsuranceSelected: this.isInsuranceSelected,
|
||||
vapsItemsToAdd: this.selectedPackage,
|
||||
supportingItemsToAdd: this.supportingItems,
|
||||
},
|
||||
forwardButtonAction() {
|
||||
this.dispatchStoreAction(
|
||||
this.storeActions.SAVE_PAYMENT_TYPE,
|
||||
this.isInsuranceSelected,
|
||||
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 });
|
||||
},
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ describe("service-package-question.vue", () => {
|
|||
await nextTick();
|
||||
|
||||
// Assert
|
||||
expect(wrapper.emitted()["update:modelValue"][0][0]).toEqual([
|
||||
expect(wrapper.emitted()["vapsItemsSelected"][0][0]).toEqual([
|
||||
{
|
||||
description: null,
|
||||
partNumber: "RAIN DEFENSE",
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@
|
|||
:buttonTypeObject="servicePackageRadio"
|
||||
v-model="selectedPackageName"
|
||||
isRequired />
|
||||
servicePackageAnswers: {{servicePackageAnswers}} <br />
|
||||
selectedPackageName: {{selectedPackageName}}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
|
@ -25,7 +27,6 @@ const packageNames = {
|
|||
export default {
|
||||
name: "servicePackageQuestion",
|
||||
props: {
|
||||
modelValue: String,
|
||||
groupName: String,
|
||||
cashCmsWidgetName: String,
|
||||
insuranceCmsWidgetName: String,
|
||||
|
|
@ -46,7 +47,7 @@ export default {
|
|||
},
|
||||
selectedPackageName(newValue) {
|
||||
const VapsProductsInSelectedPackage = this.getVapsLineItemsForSelectedPackage(newValue);
|
||||
this.$emit("update:modelValue", VapsProductsInSelectedPackage);
|
||||
this.$emit("vapsItemsSelected", VapsProductsInSelectedPackage);
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
<template>
|
||||
<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">
|
||||
<p :class="[this.buttonLabelSubCopy ? 'mb-2' : 'm-0']">
|
||||
<p class="m-0">
|
||||
<span v-html="this.buttonLabel"></span>
|
||||
<span class="pricing-info" v-html="this.buttonAuxillaryCopy"></span>
|
||||
</p>
|
||||
|
|
@ -113,6 +116,10 @@ export default {
|
|||
overflow: hidden;
|
||||
min-height: 58px;
|
||||
|
||||
&.has-subheader {
|
||||
min-height: 78px;
|
||||
}
|
||||
|
||||
&:before {
|
||||
content: "";
|
||||
position: relative;
|
||||
|
|
@ -193,12 +200,16 @@ export default {
|
|||
font-weight: 500;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
span.pricing-info {
|
||||
color: $green;
|
||||
span {
|
||||
&.pricing-info {
|
||||
color: $green;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
&.sub-label {
|
||||
color: $green;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.75rem;
|
||||
}
|
||||
}
|
||||
ul {
|
||||
|
|
@ -206,6 +217,7 @@ export default {
|
|||
padding: 0;
|
||||
li {
|
||||
margin-bottom: 0.5rem;
|
||||
font-size: 0.875rem;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -248,7 +248,9 @@ describe("vehicle-parts.vue", () => {
|
|||
(c) => c(wrapper.vm)
|
||||
);
|
||||
|
||||
wrapper.vm.navigateBack();
|
||||
store.dispatch = jest.fn(() => {});
|
||||
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
|
|
@ -294,7 +296,8 @@ describe("vehicle-parts.vue", () => {
|
|||
(c) => c(wrapper.vm)
|
||||
);
|
||||
|
||||
wrapper.vm.navigateBack();
|
||||
store.dispatch = jest.fn(() => {});
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
//Assert
|
||||
expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ export default {
|
|||
|
||||
return glass;
|
||||
},
|
||||
handleAnswerUpdates(answer, glassKey, vm) {
|
||||
handleCompletedQuestionChainAnswers(answer, glassKey, vm) {
|
||||
// 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
|
||||
// (does not get run for each invididual question's answer, only when
|
||||
|
|
@ -176,51 +176,39 @@ export default {
|
|||
self.selectedAnswers = {};
|
||||
|
||||
// loop through every answered question on the currently answered glass part
|
||||
answer.answeredQuestions?.forEach((answeredQuestion) => {
|
||||
answer.answeredQuestions?.forEach((answeredQuestion, answeredQuestionIndex) => {
|
||||
/* answeredQuestion example format:
|
||||
{
|
||||
"questionText": "Is your Grand Cherokee the Laredo model?",
|
||||
"selectedAnswer": "1|nextQuestion|3|Yes",
|
||||
"selectedAnswerText": "Yes",
|
||||
"questionNum": 1,
|
||||
}
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
// loop through all glass data
|
||||
self.questionsData.forEach((glass, glassIndex) => {
|
||||
/* glass example format:
|
||||
{
|
||||
"glassName": "Single",
|
||||
"glassLocation": "Windshield",
|
||||
"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
|
||||
}
|
||||
*/
|
||||
if (glassIndex === answer.index) {
|
||||
glass.questions.forEach((question, questionIndex) => {
|
||||
// clear out any previously set answers on first pass with first answered question
|
||||
if (answeredQuestionIndex === 0) question.answerSelected = 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) {
|
||||
let indexToSuppressTo;
|
||||
// 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
|
||||
glass.questions.forEach((question, questionIndex) => {
|
||||
// clear out any previously set answers
|
||||
question.answerSelected = null;
|
||||
// clear out any previously set answers on first pass with first answer
|
||||
if (answeredQuestionIndex === 0) question.answerSelected = null;
|
||||
|
||||
// clear or set suppressThisQuestion property for each question
|
||||
if (indexToSuppressTo && questionIndex + 1 < indexToSuppressTo) {
|
||||
|
|
@ -245,7 +233,9 @@ export default {
|
|||
|
||||
// handle matching answer in duplicated question
|
||||
question.answers.forEach((ans) => {
|
||||
if (ans.answerText.toUpperCase() === answeredQuestionAnswer) {
|
||||
if (
|
||||
ans.answerText.toUpperCase() === answeredQuestionAnswerText
|
||||
) {
|
||||
matchedAnswer = ans;
|
||||
ans.selected = true;
|
||||
} else {
|
||||
|
|
@ -339,7 +329,7 @@ export default {
|
|||
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
|
||||
self.questionsData[glassIndex].key =
|
||||
|
|
@ -473,7 +463,7 @@ export default {
|
|||
}
|
||||
},
|
||||
// Can't use `this` because navigateForward is also called from quote
|
||||
navigateBack(vm) {
|
||||
async navigateBack(vm) {
|
||||
const self = vm ?? this;
|
||||
const partsOrQuestions = (
|
||||
self.$store.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS) ??
|
||||
|
|
@ -486,6 +476,8 @@ export default {
|
|||
this.hasGlassLocationWithMultipleParts(partsOrQuestions);
|
||||
const hasChildPartQuestions = this.hasChildPartQuestions(partsOrQuestions);
|
||||
const hasCapabilityQuestions = this.hasCapabilityQuestions(partsOrQuestions);
|
||||
const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE);
|
||||
|
||||
let backNavigationScenario = self.$store.getters.vehicle.vin
|
||||
? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS
|
||||
: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS;
|
||||
|
|
@ -512,6 +504,8 @@ export default {
|
|||
this.currentPageComesAfterPage(currentPage, fmgPageValues.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);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import { shallowMount } from "@vue/test-utils";
|
|||
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||
import { storeMutations } from "@/constants/store-mutations";
|
||||
import store from "@/store";
|
||||
import { storeActions } from "@/constants/store-actions";
|
||||
import { navigationScenarios } from "../router/router-constants/navigation-scenarios";
|
||||
import { getters } from "@/store";
|
||||
|
|
@ -410,7 +411,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("handleAnswerUpdates", () => {
|
||||
describe("handleCompletedQuestionChainAnswers", () => {
|
||||
describe("selectedAnswers", () => {
|
||||
test("should be cleared to be empty", () => {
|
||||
// Arrange
|
||||
|
|
@ -419,6 +420,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||
selectedAnswerText: "Yes",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -438,7 +440,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.selectedAnswers).toMatchObject({});
|
||||
|
|
@ -453,6 +455,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||
selectedAnswerText: "Yes",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -477,7 +480,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.questionsData[1].answerData).toEqual(null);
|
||||
|
|
@ -489,6 +492,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||
selectedAnswerText: "Yes",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -514,7 +518,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.questionsData[1].isSuppressedPart).toEqual(null);
|
||||
|
|
@ -526,6 +530,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|Yes",
|
||||
selectedAnswerText: "Yes",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -587,7 +592,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answer, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answer, "", wrapper.vm);
|
||||
|
||||
// Assert
|
||||
expect(wrapper.vm.questionsData[1].questions[0].answerSelected).toEqual(null);
|
||||
|
|
@ -603,6 +608,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|No",
|
||||
selectedAnswerText: "No",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -661,7 +667,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||
const glassWithDuplicate = wrapper.vm.questionsData[1];
|
||||
|
||||
// Assert
|
||||
|
|
@ -675,6 +681,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|No",
|
||||
selectedAnswerText: "No",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -731,7 +738,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||
const duplicateQuestion = wrapper.vm.questionsData[1].questions[0];
|
||||
|
||||
// Assert
|
||||
|
|
@ -746,6 +753,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|No",
|
||||
selectedAnswerText: "No",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -835,7 +843,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||
const nextQuestionAfterDuplicate = wrapper.vm.questionsData[1].questions[2];
|
||||
|
||||
// Assert
|
||||
|
|
@ -849,6 +857,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test question 3?",
|
||||
selectedAnswer: "1|nextQuestion|3|No",
|
||||
selectedAnswerText: "No",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -969,7 +978,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||
const duplicatedQuestion = wrapper.vm.questionsData[1].questions[2];
|
||||
const duplicatedQuestionAnswer = duplicatedQuestion.answers.filter((a) => {
|
||||
return a.selected;
|
||||
|
|
@ -997,6 +1006,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test duplicate question 1?",
|
||||
selectedAnswer: "1|nextQuestion|3|No",
|
||||
selectedAnswerText: "No",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -1085,7 +1095,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
||||
wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||
|
||||
// Assert
|
||||
expect(
|
||||
|
|
@ -1109,6 +1119,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
answeredQuestions: [
|
||||
{
|
||||
questionText: "Test question 3?",
|
||||
selectedAnswer: "1|nextQuestion|3|No",
|
||||
selectedAnswerText: "No",
|
||||
questionNum: 1,
|
||||
},
|
||||
|
|
@ -1197,7 +1208,7 @@ describe("vehicle-questions-mixin", () => {
|
|||
];
|
||||
|
||||
// Act
|
||||
await wrapper.vm.handleAnswerUpdates(answerNo, "", wrapper.vm);
|
||||
await wrapper.vm.handleCompletedQuestionChainAnswers(answerNo, "", wrapper.vm);
|
||||
|
||||
const questionsToTest = wrapper.vm.questionsData[1].questions;
|
||||
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"
|
||||
);
|
||||
|
||||
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
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE, hasVin: true });
|
||||
|
||||
// Act
|
||||
wrapper.vm.navigateBack();
|
||||
store.dispatch = jest.fn(() => {});
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
// Assert
|
||||
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
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||
|
||||
// Act
|
||||
wrapper.vm.navigateBack();
|
||||
store.dispatch = jest.fn(() => {});
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
// Assert
|
||||
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
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.QUOTE });
|
||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||
wrapper.vm.hasChildPartQuestions = jest.fn().mockReturnValue(true);
|
||||
|
||||
// Act
|
||||
wrapper.vm.navigateBack();
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
// Assert
|
||||
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
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||
|
|
@ -2303,7 +2316,8 @@ describe("vehicle-questions-mixin", () => {
|
|||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||
|
||||
// Act
|
||||
wrapper.vm.navigateBack();
|
||||
store.dispatch = jest.fn(() => {});
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
// Assert
|
||||
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
|
||||
const { wrapper } = setupMocks({ fmgPage: fmgPageValues.MOLDING_QUESTIONS });
|
||||
wrapper.vm.hasPartQuestions = jest.fn().mockReturnValue(true);
|
||||
|
|
@ -2321,7 +2335,8 @@ describe("vehicle-questions-mixin", () => {
|
|||
wrapper.vm.hasCapabilityQuestions = jest.fn().mockReturnValue(true);
|
||||
|
||||
// Act
|
||||
wrapper.vm.navigateBack();
|
||||
store.dispatch = jest.fn(() => {});
|
||||
await wrapper.vm.navigateBack();
|
||||
|
||||
// Assert
|
||||
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_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_TO_GO_TO_ESTIMATE: "CLICKED_BACK_TO_GO_TO_ESTIMATE",
|
||||
};
|
||||
|
||||
export { navigationScenarios };
|
||||
|
|
|
|||
|
|
@ -251,6 +251,22 @@ const routingTable = function (store) {
|
|||
scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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,
|
||||
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.CAPABILITY_QUESTIONS] = null;
|
||||
},
|
||||
resetSupportingItemsState(state) {
|
||||
state.order.lineItems.supportingItems = null;
|
||||
},
|
||||
resetVapsState(state) {
|
||||
state.order.lineItems.vaps = null;
|
||||
},
|
||||
resetState(state) {
|
||||
Object.assign(state, getDefaultState());
|
||||
},
|
||||
|
|
@ -589,19 +583,17 @@ export const actions = {
|
|||
resetDamageAndDependencies(context) {
|
||||
context.commit(storeMutations.RESET_DAMAGE_STATE);
|
||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||
context.commit(storeMutations.UPDATE_VAPS, null);
|
||||
},
|
||||
resetRegistrationAndDependencies(context) {
|
||||
context.commit(storeMutations.RESET_REGISTRATION_STATE);
|
||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||
},
|
||||
resetPartsAndDependencies(context) {
|
||||
context.commit(storeMutations.RESET_GLASS_PARTS_STATE);
|
||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||
},
|
||||
resetState(context) {
|
||||
context.commit(storeMutations.RESET_STATE);
|
||||
|
|
@ -1286,6 +1278,7 @@ export const actions = {
|
|||
if (isDamageChanging) {
|
||||
//Reset dependent state when changing
|
||||
context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
|
||||
context.commit(storeMutations.UPDATE_VAPS, null);
|
||||
|
||||
// Save new values
|
||||
context.commit(storeMutations.UPDATE_IS_REPAIR, isWindshieldRepair);
|
||||
|
|
@ -1377,7 +1370,7 @@ export const actions = {
|
|||
|
||||
if (havePartQuestionAnswersChanged) {
|
||||
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_CAPABILITY_QUESTION_ANSWERS, null);
|
||||
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
||||
|
|
@ -1423,7 +1416,7 @@ export const actions = {
|
|||
|
||||
if (haveSelectedVehiclePartsChanged) {
|
||||
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_CAPABILITY_QUESTION_ANSWERS, null);
|
||||
context.commit(storeMutations.UPDATE_PAGE_DATA, {
|
||||
|
|
@ -1453,7 +1446,7 @@ export const actions = {
|
|||
|
||||
if (haveMoldingQuestionAnswersChanged) {
|
||||
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_PAGE_DATA, {
|
||||
page: fmgPageValues.CAPABILITY_QUESTIONS,
|
||||
|
|
@ -1481,7 +1474,7 @@ export const actions = {
|
|||
|
||||
if (haveCapabilityQuestionAnswersChanged) {
|
||||
context.commit(storeMutations.UPDATE_GLASS_PARTS, null);
|
||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, null);
|
||||
}
|
||||
|
||||
//Save new values
|
||||
|
|
@ -1490,16 +1483,14 @@ export const actions = {
|
|||
capabilityQuestionAnswers
|
||||
);
|
||||
},
|
||||
// Quote Page
|
||||
saveQuotePageSelections(
|
||||
context,
|
||||
{ isInsuranceSelected, vapsItemsToAdd, supportingItemsToAdd }
|
||||
) {
|
||||
context.commit(storeMutations.RESET_SUPPORTING_ITEMS_STATE);
|
||||
context.commit(storeMutations.RESET_VAPS_STATE);
|
||||
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsuranceSelected);
|
||||
context.commit(storeMutations.UPDATE_VAPS, vapsItemsToAdd);
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItemsToAdd);
|
||||
savePaymentType(context, isInsurance) {
|
||||
context.commit(storeMutations.UPDATE_IS_INSURANCE, isInsurance);
|
||||
},
|
||||
saveSupportingItems(context, supportingItems) {
|
||||
context.commit(storeMutations.UPDATE_SUPPORTING_ITEMS, supportingItems);
|
||||
},
|
||||
saveVaps(context, vaps) {
|
||||
context.commit(storeMutations.UPDATE_VAPS, vaps);
|
||||
},
|
||||
// Price order actions
|
||||
// PLACEHOLDER, WILL CHANGE WHEN PRICING END POINT IS IMPLEMENTED
|
||||
|
|
@ -1550,8 +1541,9 @@ export const actions = {
|
|||
if (
|
||||
context.state.order.vehicle.make.toLowerCase() === "ford" &&
|
||||
context.state.order.vehicle.year >= 2018
|
||||
)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (
|
||||
context.state.order.vehicle.make.toLowerCase() === "bmw" &&
|
||||
|
|
|
|||
Loading…
Reference in a new issue