CSR-110 resolve conflicts with merged develop branch
This commit is contained in:
commit
8034ce8d28
15 changed files with 345 additions and 38 deletions
|
|
@ -89,7 +89,7 @@ export default {
|
||||||
modelValue: [Array, String],
|
modelValue: [Array, String],
|
||||||
validationRules: String,
|
validationRules: String,
|
||||||
suppressError: Boolean,
|
suppressError: Boolean,
|
||||||
useTextForValue: Boolean
|
useTextForValue: Boolean,
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
formattedGroupName() {
|
formattedGroupName() {
|
||||||
|
|
|
||||||
|
|
@ -63,12 +63,14 @@ import { Form, defineRule } from "vee-validate";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "molding-questions",
|
name: "molding-questions",
|
||||||
|
mixins: [vehicleQuestionsMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
@ -111,7 +113,6 @@ export default {
|
||||||
return this.getCmsContent("AlertPartsQuestions", "BodyText");
|
return this.getCmsContent("AlertPartsQuestions", "BodyText");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mixins: [vehicleQuestionsMixin],
|
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
return true; // TODO - DO TRUE TEST OF PAGEDATA
|
return true; // TODO - DO TRUE TEST OF PAGEDATA
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ import { Form, defineRule } from "vee-validate";
|
||||||
import { required } from "@/helpers/validation-rules";
|
import { required } from "@/helpers/validation-rules";
|
||||||
import { errorMessages } from "@/constants/error-messages";
|
import { errorMessages } from "@/constants/error-messages";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
import loadingModal from '@/common-components/loading-modal/loading-modal.vue';
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
// DEFINE VALIDATION RULES
|
// DEFINE VALIDATION RULES
|
||||||
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
defineRule("questions-required", required(errorMessages.OPTION_REQUIRED));
|
||||||
|
|
@ -92,7 +92,7 @@ export default {
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
selectedModel: [],
|
selectedModel: [],
|
||||||
partsQuestionsData: this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions.filter((p) => {
|
partsQuestionsData: this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS)?.partsOrQuestions.filter((p) => {
|
||||||
if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) {
|
if (Array.isArray(p.partQuestions) && p.partQuestions.length > 0) {
|
||||||
return {
|
return {
|
||||||
glassName: p.glassName,
|
glassName: p.glassName,
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
import { nextTick } from "vue";
|
import { nextTick } from "vue";
|
||||||
import baseMixin from "@/mixins/base-mixin.js";
|
import baseMixin from "@/mixins/base-mixin.js";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
// Mock our module for promises.
|
// Mock our module for promises.
|
||||||
jest.mock("@/helpers/layout-helper.js", () => ({
|
jest.mock("@/helpers/layout-helper.js", () => ({
|
||||||
|
|
@ -21,6 +22,10 @@ jest.mock("@/helpers/cms-content-helper", () => ({
|
||||||
fetchCmsContentForPage: jest.fn(),
|
fetchCmsContentForPage: jest.fn(),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
jest.mock("@/helpers/heritage-integration/navigation-helper", () => ({
|
||||||
|
navigateToHeritageFunnel: jest.fn()
|
||||||
|
}));
|
||||||
|
|
||||||
// Mock store
|
// Mock store
|
||||||
jest.mock("@/store", () => { return {}; }, { virtual: true });
|
jest.mock("@/store", () => { return {}; }, { virtual: true });
|
||||||
|
|
||||||
|
|
@ -211,17 +216,107 @@ describe("vehicle-parts.vue", () => {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test("ForwardButtonAction triggers a router.navigate change and saves selected parts to store", async () => {
|
test("ForwardButtonAction triggers a router.navigate change if there are child part questions", async () => {
|
||||||
|
|
||||||
//Arrange
|
//Arrange
|
||||||
store.getters.pageData.mockReturnValueOnce(basePartResponse);
|
store.getters.pageData.mockReturnValueOnce({
|
||||||
store.getters.lineItems = { glassParts: {} }
|
partsOrQuestions: [
|
||||||
store.commit = jest.fn();
|
{
|
||||||
|
glassName: "Single",
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
parts: [
|
||||||
|
{
|
||||||
|
"partNumber": "FW03861GTYN",
|
||||||
|
"description": "rain sensor, heated glass, auto dimming mirror, solar, 3rd visor band, condensation sensor",
|
||||||
|
"color": "Green Tint",
|
||||||
|
"requiresRecalibration": false,
|
||||||
|
"requiresCapabilityQuestions": false,
|
||||||
|
"recalibrationType": null,
|
||||||
|
"childParts": null,
|
||||||
|
"childPartQuestions": [
|
||||||
|
{
|
||||||
|
"questionSequence": 1,
|
||||||
|
"questionText": "Does the rubber seal around your windshield have a chrome strip running through it?",
|
||||||
|
"answers": [
|
||||||
|
{
|
||||||
|
"answerResult": "WKT D1106 C",
|
||||||
|
"answerText": "Yes",
|
||||||
|
"nextQuestionSequence": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"answerResult": "WKT D1106 B",
|
||||||
|
"answerText": "No",
|
||||||
|
"nextQuestionSequence": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
partQuestions: null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
const { wrapper } = setupMocks({
|
||||||
|
mountOptionsMockData: {
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
},
|
||||||
|
route: {
|
||||||
|
query: {
|
||||||
|
fmgPage: 'vehicle-parts',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
store: {
|
||||||
|
getters: store.getters,
|
||||||
|
commit: store.commit
|
||||||
|
},
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
wrapper.setData({ glassParts: { "Rear-Stationary": { partNumber: 'FW03861GTYN' } } });
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleParts.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-parts" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("ForwardButtonAction triggers a router.navigate change if there are capability questions", async () => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
store.getters.pageData.mockReturnValueOnce({
|
||||||
|
partsOrQuestions: [
|
||||||
|
{
|
||||||
|
glassName: "Single",
|
||||||
|
glassLocation: "Windshield",
|
||||||
|
parts: [
|
||||||
|
{
|
||||||
|
partNumber: "DB12209GTYN",
|
||||||
|
description: "heated glass, solar, 1 hole",
|
||||||
|
color: "Green Tint",
|
||||||
|
requiresRecalibration: false,
|
||||||
|
requiresCapabilityQuestions: true,
|
||||||
|
childParts: null
|
||||||
|
}
|
||||||
|
],
|
||||||
|
partQuestions: null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
const { wrapper } = setupMocks({
|
const { wrapper } = setupMocks({
|
||||||
mountOptionsMockData: {
|
mountOptionsMockData: {
|
||||||
router: {
|
router: {
|
||||||
navigate: jest.fn(),
|
|
||||||
navigate: jest.fn()
|
navigate: jest.fn()
|
||||||
},
|
},
|
||||||
route: {
|
route: {
|
||||||
|
|
@ -251,6 +346,50 @@ describe("vehicle-parts.vue", () => {
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("ForwardButtonAction saves selected parts to store if no molding or capability questions", async () => {
|
||||||
|
|
||||||
|
//Arrange
|
||||||
|
store.getters.pageData.mockReturnValueOnce(basePartResponse);
|
||||||
|
store.getters.lineItems = { glassParts: {} }
|
||||||
|
|
||||||
|
const { wrapper } = setupMocks({
|
||||||
|
mountOptionsMockData: {
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
},
|
||||||
|
route: {
|
||||||
|
query: {
|
||||||
|
fmgPage: 'vehicle-parts',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
store: {
|
||||||
|
getters: store.getters,
|
||||||
|
commit: store.commit
|
||||||
|
},
|
||||||
|
navigateToHeritageFunnel: jest.fn()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
wrapper.vm.$store.commit = jest.fn();
|
||||||
|
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
|
||||||
|
|
||||||
|
wrapper.setData({ glassParts: { "Rear-Stationary": { partNumber: 'DB12209GTYN' } } });
|
||||||
|
|
||||||
|
//Act
|
||||||
|
vehicleParts.beforeRouteEnter.call(
|
||||||
|
wrapper.vm,
|
||||||
|
{ query: { fmgPage: "vehicle-parts" } },
|
||||||
|
undefined,
|
||||||
|
(c) => c(wrapper.vm)
|
||||||
|
);
|
||||||
|
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
//Assert
|
||||||
|
expect(wrapper.vm.$store.commit).toHaveBeenCalled();
|
||||||
|
expect(navigateToHeritageFunnel).toHaveBeenCalled();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {} }) {
|
function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {} }) {
|
||||||
|
|
@ -288,6 +427,7 @@ function setupMocks({ pageHeaderWidgetHeaderText = {}, mountOptionsMockData = {}
|
||||||
|
|
||||||
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
|
||||||
wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn();
|
wrapper.vm.$refs.funnelFooter.removeLoader = jest.fn();
|
||||||
|
wrapper.vm.$refs.loadingModal.showModal = jest.fn();
|
||||||
|
|
||||||
return { wrapper, apiPromise };
|
return { wrapper, apiPromise };
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,7 @@ import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
|
||||||
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
|
||||||
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
|
||||||
import alert from "@/ux-components/alert/alert";
|
import alert from "@/ux-components/alert/alert";
|
||||||
|
import loadingModal from '@/common-components/loading-modal/loading-modal.vue';
|
||||||
// Supporting Files
|
// Supporting Files
|
||||||
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
|
||||||
import { settleAllPromises } from "@/helpers/layout-helper";
|
import { settleAllPromises } from "@/helpers/layout-helper";
|
||||||
|
|
@ -65,10 +66,11 @@ import { Form } from "vee-validate";
|
||||||
import store from "@/store";
|
import store from "@/store";
|
||||||
import { storeMutations } from "@/constants/store-mutations.js";
|
import { storeMutations } from "@/constants/store-mutations.js";
|
||||||
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
import loadingModal from '@/common-components/loading-modal/loading-modal.vue';
|
import { navigateToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "vehicle-parts",
|
name: "vehicle-parts",
|
||||||
|
mixins: [vehicleQuestionsMixin],
|
||||||
async beforeRouteEnter(to, from, next) {
|
async beforeRouteEnter(to, from, next) {
|
||||||
// Call APIs
|
// Call APIs
|
||||||
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);
|
||||||
|
|
@ -150,17 +152,20 @@ export default {
|
||||||
return "partQuestion";
|
return "partQuestion";
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
mixins: [vehicleQuestionsMixin],
|
|
||||||
methods: {
|
methods: {
|
||||||
arePagePrerequisitesValid() {
|
arePagePrerequisitesValid() {
|
||||||
// Check if isRepair is populated and if the pageData we need is here (Parts data)
|
// Check if isRepair is populated and if the pageData we need is here (Parts data)
|
||||||
if (store.getters.damage.isRepair != null && Object.keys(store.getters.pageData(fmgPageValues.VEHICLE_PARTS)).length !== 0) {
|
return store.getters.damage.isRepair != null &&
|
||||||
return true;
|
Object.keys(store.getters.pageData(fmgPageValues.VEHICLE_PARTS)).length !== 0;
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
backButtonAction() {
|
backButtonAction() {
|
||||||
this.$router.navigate(this.navigationScenarios.CLICKED_BACK, this.$route);
|
const hasPartQuestions = this.hasPartQuestions(this.$store.getters.pageData(fmgPageValues.PART_QUESTIONS).partsOrQuestions);
|
||||||
|
const backNavigationScenario = hasPartQuestions ? this.navigationScenarios.CLICKED_BACK_WITH_PART_QUESTION_ANSWERS : this.navigationScenarios.CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS;
|
||||||
|
|
||||||
|
this.$router.navigate(
|
||||||
|
backNavigationScenario,
|
||||||
|
this.$route
|
||||||
|
);
|
||||||
},
|
},
|
||||||
async forwardButtonAction() {
|
async forwardButtonAction() {
|
||||||
const matchedParts = [];
|
const matchedParts = [];
|
||||||
|
|
|
||||||
161
src/mixins/vehicle-questions-mixin.spec.js
Normal file
161
src/mixins/vehicle-questions-mixin.spec.js
Normal file
|
|
@ -0,0 +1,161 @@
|
||||||
|
import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin";
|
||||||
|
import { shallowMount } from "@vue/test-utils";
|
||||||
|
import { setupMocksForJsFiles, getMountOptions } from "@/helpers/unit-test-helper.js";
|
||||||
|
|
||||||
|
describe("vehicle-questions-mixin", () => {
|
||||||
|
describe("hasPartQuestions", () => {
|
||||||
|
test("has no part questions => return false", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const hasPartQuestions = wrapper.vm.hasPartQuestions([
|
||||||
|
{
|
||||||
|
partQuestions: []
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(hasPartQuestions).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("has undefined part questions => return false", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const hasPartQuestions = wrapper.vm.hasPartQuestions([])
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(hasPartQuestions).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("has part questions => return true", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const hasPartQuestions = wrapper.vm.hasPartQuestions([
|
||||||
|
{
|
||||||
|
partQuestions: [{
|
||||||
|
testProperty: "some value"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(hasPartQuestions).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("hasGlassLocationWithMultipleParts", () => {
|
||||||
|
test("has one part for one glass location => return false", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const hasGlassLocationWithMultipleParts = wrapper.vm.hasGlassLocationWithMultipleParts([
|
||||||
|
{
|
||||||
|
glassName: "Something",
|
||||||
|
glassLocation: "somewhere",
|
||||||
|
parts: [{
|
||||||
|
partNumber: "1234567"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(hasGlassLocationWithMultipleParts).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("has one part for every glass location => return false", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const hasGlassLocationWithMultipleParts = wrapper.vm.hasGlassLocationWithMultipleParts([
|
||||||
|
{
|
||||||
|
glassName: "Something",
|
||||||
|
glassLocation: "somewhere",
|
||||||
|
parts: [{
|
||||||
|
partNumber: "1234567"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassName: "Another glass",
|
||||||
|
glassLocation: "somewhere else",
|
||||||
|
parts: [{
|
||||||
|
partNumber: "1234568"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassName: "Special glass",
|
||||||
|
glassLocation: "Another where",
|
||||||
|
parts: [{
|
||||||
|
partNumber: "1234569"
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(hasGlassLocationWithMultipleParts).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("has multiple parts for one glass location => return true", () => {
|
||||||
|
// Arrange
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
|
||||||
|
// Act
|
||||||
|
const hasGlassLocationWithMultipleParts = wrapper.vm.hasGlassLocationWithMultipleParts([
|
||||||
|
{
|
||||||
|
glassName: "Something",
|
||||||
|
glassLocation: "somewhere",
|
||||||
|
parts: [{
|
||||||
|
partNumber: "1234567"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassName: "Another glass",
|
||||||
|
glassLocation: "somewhere else",
|
||||||
|
parts: [{
|
||||||
|
partNumber: "1234568"
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
glassName: "Special glass",
|
||||||
|
glassLocation: "Another where",
|
||||||
|
parts: [
|
||||||
|
{
|
||||||
|
partNumber: "1234569"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
partNumber: "1234560"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
])
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(hasGlassLocationWithMultipleParts).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
function setupMocks({}) {
|
||||||
|
const baseMixin = setupMocksForJsFiles({});
|
||||||
|
|
||||||
|
const mocks = getMountOptions({
|
||||||
|
router: {
|
||||||
|
navigate: jest.fn()
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
const mockVehicleQuestionComponent = {
|
||||||
|
template: '<div></div>',
|
||||||
|
mixins: [vehicleQuestionsMixin, baseMixin.baseMixin]
|
||||||
|
};
|
||||||
|
|
||||||
|
const wrapper = shallowMount(mockVehicleQuestionComponent, mocks);
|
||||||
|
|
||||||
|
return { wrapper };
|
||||||
|
}
|
||||||
|
|
@ -40,6 +40,6 @@ export default {
|
||||||
this.$refs.loadingModal.showModal();
|
this.$refs.loadingModal.showModal();
|
||||||
navigateToHeritageFunnel();
|
navigateToHeritageFunnel();
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -176,8 +176,11 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara
|
||||||
if (destinationFmgPageValue !== undefined) {
|
if (destinationFmgPageValue !== undefined) {
|
||||||
// We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one.
|
// We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one.
|
||||||
|
|
||||||
// Append page data to the store for the NEXT page, if any. It will be an empty object if none is provided.
|
// Update page data to the store for next page if provided. Otherwise, use existing page data or override with empty object
|
||||||
|
const existingPageData = store.getters.pageData(destinationFmgPageValue) ?? {};
|
||||||
|
if (Object.keys(optionalPageData).length > 0 && Object.keys(existingPageData).length === 0) {
|
||||||
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData);
|
baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData);
|
||||||
|
}
|
||||||
|
|
||||||
// if cookie and referralNumber/Date exists OR an emailAddress has been saved
|
// if cookie and referralNumber/Date exists OR an emailAddress has been saved
|
||||||
if ((getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) || store.getters.order.customer?.emailAddress) {
|
if ((getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) || store.getters.order.customer?.emailAddress) {
|
||||||
|
|
|
||||||
|
|
@ -21,9 +21,11 @@ const navigationScenarios = {
|
||||||
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
|
SELECTED_HOME_ADDRESS: "SELECTED_HOME_ADDRESS",
|
||||||
ANSWERED_QUESTIONS_WITH_SINGLE_PART: "ANSWERED_QUESTIONS_WITH_SINGLE_PART",
|
ANSWERED_QUESTIONS_WITH_SINGLE_PART: "ANSWERED_QUESTIONS_WITH_SINGLE_PART",
|
||||||
ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS: "ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS",
|
ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS: "ANSWERED_QUESTIONS_WITH_MULTIPLE_PARTS",
|
||||||
|
SELECTED_PROVIDE_VIN_DIFFERENT_WAY: "SELECTED_PROVIDE_VIN_DIFFERENT_WAY",
|
||||||
|
CLICKED_BACK_WITH_PART_QUESTION_ANSWERS: "CLICKED_BACK_WITH_PART_QUESTION_ANSWERS",
|
||||||
|
CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS: "CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS",
|
||||||
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
|
HAS_MOLDING_QUESTIONS: "HAS_MOLDING_QUESTIONS",
|
||||||
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
|
HAS_CAPABILITY_QUESTIONS: "HAS_CAPABILITY_QUESTIONS",
|
||||||
SELECTED_PROVIDE_VIN_DIFFERENT_WAY: "SELECTED_PROVIDE_VIN_DIFFERENT_WAY"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export { navigationScenarios };
|
export { navigationScenarios };
|
||||||
|
|
|
||||||
|
|
@ -82,10 +82,6 @@ const routingTable = function(store) {
|
||||||
{
|
{
|
||||||
fmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
fmgPageValue: fmgPageValues.VEHICLE_PARTS,
|
||||||
maps: [
|
maps: [
|
||||||
{
|
|
||||||
scenario: navigationScenarios.CLICKED_BACK,
|
|
||||||
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
scenario: navigationScenarios.SELECTED_PARTS,
|
scenario: navigationScenarios.SELECTED_PARTS,
|
||||||
destinationFmgPageValue: fmgPageValues.QUOTE,
|
destinationFmgPageValue: fmgPageValues.QUOTE,
|
||||||
|
|
@ -94,6 +90,14 @@ const routingTable = function(store) {
|
||||||
scenario: navigationScenarios.CLICKED_FORWARD,
|
scenario: navigationScenarios.CLICKED_FORWARD,
|
||||||
destinationFmgPageValue: fmgPageValues.REVEAL,
|
destinationFmgPageValue: fmgPageValues.REVEAL,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTION_ANSWERS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.PART_QUESTIONS,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
scenario: navigationScenarios.CLICKED_BACK_WITHOUT_PART_QUESTION_ANSWERS,
|
||||||
|
destinationFmgPageValue: fmgPageValues.VIN_LOOKUP,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { getDateForSavedSessionTimeout } from "@/helpers/heritage-integration/se
|
||||||
import createPersistedState from "vuex-persistedstate";
|
import createPersistedState from "vuex-persistedstate";
|
||||||
import globalMethods from "@/global-methods";
|
import globalMethods from "@/global-methods";
|
||||||
import { storeActions } from "../constants/store-actions";
|
import { storeActions } from "../constants/store-actions";
|
||||||
|
import { fmgPageValues } from "@/router/router-constants/fmgPage-values";
|
||||||
|
|
||||||
// Export State
|
// Export State
|
||||||
const getDefaultState = () => {
|
const getDefaultState = () => {
|
||||||
|
|
@ -265,6 +266,8 @@ export const mutations = {
|
||||||
},
|
},
|
||||||
resetGlassPartsState(state) {
|
resetGlassPartsState(state) {
|
||||||
state.order.lineItems.glassParts = null;
|
state.order.lineItems.glassParts = null;
|
||||||
|
state.order.damage.partQuestionAnswers = null;
|
||||||
|
state.applicationUser.pageData[fmgPageValues.PART_QUESTIONS] = null;
|
||||||
},
|
},
|
||||||
resetState(state) {
|
resetState(state) {
|
||||||
Object.assign(state, getDefaultState());
|
Object.assign(state, getDefaultState());
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,6 @@ export default {
|
||||||
: this.selectedValues[0];
|
: this.selectedValues[0];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unmounted() { // needed to clear this button's selectedValues if it is removed
|
|
||||||
this.checkValue = false;
|
|
||||||
this.handleCheckChange();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
displayLoader() {
|
displayLoader() {
|
||||||
this.isLoaderDisplayed = true;
|
this.isLoaderDisplayed = true;
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,6 @@ export default {
|
||||||
: this.selectedValues[0];
|
: this.selectedValues[0];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unmounted() { // needed to clear this button's selectedValues if it is removed
|
|
||||||
this.checkValue = false;
|
|
||||||
this.handleCheckChange();
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
displayLoader() {
|
displayLoader() {
|
||||||
this.isLoaderDisplayed = true;
|
this.isLoaderDisplayed = true;
|
||||||
|
|
|
||||||
|
|
@ -110,10 +110,6 @@ export default {
|
||||||
this.checkValue = this.selectedValues == this.value || this.modelValue == this.value;
|
this.checkValue = this.selectedValues == this.value || this.modelValue == this.value;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
unmounted() { // needed to clear this button's selectedValues if it is removed
|
|
||||||
this.checkValue = false;
|
|
||||||
this.handleCheckChange();
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
getLabelClasses() {
|
getLabelClasses() {
|
||||||
if (this.isWide) {
|
if (this.isWide) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue