From 140f94913ee62c2342e011c92b3e21c754d1fcba Mon Sep 17 00:00:00 2001 From: Kroell Date: Tue, 7 Feb 2023 15:48:22 -0500 Subject: [PATCH 01/19] build molding-questions page --- .../molding-questions/molding-questions.vue | 199 +++++++++++++----- src/store/index.js | 28 +++ 2 files changed, 175 insertions(+), 52 deletions(-) diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index bdf3e956..23f1c519 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -2,66 +2,53 @@
-
- - - -
-

Placeholder for molding-questions page

- - -
-
+ + + \ No newline at end of file diff --git a/src/store/index.js b/src/store/index.js index abb22d83..d664f46b 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -701,6 +701,34 @@ export const useMainStore = defineStore({ //Save new values this.updatePartQuestionAnswers(partQuestionAnswersArray); }, + saveMoldingQuestionAnswers(moldingQuestionAnswers) { + const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue( + this.getters.damage.moldingQuestionAnswers, + "partNum" + ); + const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue( + moldingQuestionAnswers, + "partNum" + ); + const haveMoldingQuestionAnswersChanged = + sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length || + !sortedPreviousResultsArray?.every( + (x, i) => x.partNum === sortedMoldingQuestionAnswersArray[i].partNum + ); + + if (haveMoldingQuestionAnswersChanged) { + this.updateGlassParts(null); + this.updateSupportingItems(null); + this.updateCapabilityQuestionAnswers(null); + this.updatePageData({ + page: issPageValues.CAPABILITY_QUESTIONS, + data: null, + }); + } + + // Save new values + this.updateMoldingQuestionAnswers(moldingQuestionAnswers); + }, addEventToBus (event) { this.applicationUser.eventBus.push(event); From ec8731f9a348b52c5a84216902915870f0986bb6 Mon Sep 17 00:00:00 2001 From: Kroell Date: Wed, 8 Feb 2023 15:40:46 -0500 Subject: [PATCH 02/19] navigation for molding-questions --- .../molding-questions/molding-questions.vue | 10 +++++----- src/router/router-constants/routing-table.js | 2 +- src/store/index.js | 14 +++++++------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index 23f1c519..44b4cd38 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -86,7 +86,7 @@ export default { }, methods: { arePagePrerequisiteValid() { - const moldingQuestionsFromPageData = useMainStore().getters.pageData( + const moldingQuestionsFromPageData = useMainStore().pageData( issPageValues.MOLDING_QUESTIONS ); return ( @@ -102,7 +102,7 @@ export default { getInitialQuestionData() { // get any questions that were already answered const alreadyAnsweredQuestions = - useMainStore().order.damage.moldingQuestionAnswers; + useMainStore().damage.moldingQuestionAnswers; this.questionsData = this.partsOrQuestionsData .filter((x) => x.parts[0].childPartQuestions.length) .map((glass, index) => { @@ -121,7 +121,7 @@ export default { "selectedAnswers." + glass.answerKey, (newValue) => { if (newValue && Object.keys(newValue).length > 0) { - this.handleCompletedQuestionChainAnswers( + this.handleAnswerUpdates( newValue, glass.answerKey ); @@ -147,7 +147,7 @@ export default { glass.answerData = {}; }); // save to store as order.damage.moldingQuestionArrays (array) - await useMainStore().saveMoldingQuestionAnswers(questionAnswersArray); + await this.mainStore.saveMoldingQuestionAnswers(questionAnswersArray); // get parts from the questionAnswers let partsOrQuestions = this.partsOrQuestionsData; @@ -163,7 +163,7 @@ export default { }, ]; } - this.navigateForward(partsOrQuestions); + this.navigateForward(partsOrQuestions, null); }, }, components: { diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 95179d81..78dbb55a 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -235,7 +235,7 @@ const routingTable = function(store) { }, { scenario: navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS, - destinationIssPageValue: issPageValues.ESTIMATE, + destinationIssPageValue: issPageValues.VEHICLE_LOOKUP, }, { scenario: navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, diff --git a/src/store/index.js b/src/store/index.js index d664f46b..db172dde 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -701,19 +701,19 @@ export const useMainStore = defineStore({ //Save new values this.updatePartQuestionAnswers(partQuestionAnswersArray); }, - saveMoldingQuestionAnswers(moldingQuestionAnswers) { + saveMoldingQuestionAnswers(moldingQuestionAnswersArray) { const sortedPreviousResultsArray = sortArrayOfObjectsByPropertyValue( - this.getters.damage.moldingQuestionAnswers, - "partNum" + this.order.damage.moldingQuestionAnswers, + "result" ); const sortedMoldingQuestionAnswersArray = sortArrayOfObjectsByPropertyValue( - moldingQuestionAnswers, - "partNum" + moldingQuestionAnswersArray, + "result" ); const haveMoldingQuestionAnswersChanged = sortedPreviousResultsArray?.length !== sortedMoldingQuestionAnswersArray.length || !sortedPreviousResultsArray?.every( - (x, i) => x.partNum === sortedMoldingQuestionAnswersArray[i].partNum + (x, i) => x.result === sortedMoldingQuestionAnswersArray[i].result ); if (haveMoldingQuestionAnswersChanged) { @@ -727,7 +727,7 @@ export const useMainStore = defineStore({ } // Save new values - this.updateMoldingQuestionAnswers(moldingQuestionAnswers); + this.updateMoldingQuestionAnswers(moldingQuestionAnswersArray); }, addEventToBus (event) { From d54694ebaf9a9b7056c64e9d2dfb38d618e31d15 Mon Sep 17 00:00:00 2001 From: Kroell Date: Thu, 9 Feb 2023 11:53:23 -0500 Subject: [PATCH 03/19] change to getPartsOrQuestions method - zip code can be empty string --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index abb22d83..1cd57344 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -341,7 +341,7 @@ export const useMainStore = defineStore({ payload: { carId: carId, glassPieces: glassArrayForPayload, - zip: zipCode, + zip: zipCode ? zipCode : "", vin: vin, }, }); From 4f31b1c8f06cae3b1a90c19524d4564023ed4318 Mon Sep 17 00:00:00 2001 From: Kroell Date: Thu, 9 Feb 2023 15:02:16 -0500 Subject: [PATCH 04/19] Reverting change for SSR-257 - zipCode will either pull registration.zip or customer.address.zip --- src/store/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/store/index.js b/src/store/index.js index b08671f5..db172dde 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -341,7 +341,7 @@ export const useMainStore = defineStore({ payload: { carId: carId, glassPieces: glassArrayForPayload, - zip: zipCode ? zipCode : "", + zip: zipCode, vin: vin, }, }); From 3686e4907dbba94661ea119ab98f11aac44fa72c Mon Sep 17 00:00:00 2001 From: Kroell Date: Thu, 9 Feb 2023 15:02:47 -0500 Subject: [PATCH 05/19] fix to navigation from molding-questions --- src/layouts/molding-questions/molding-questions.vue | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index 44b4cd38..e3c6c13e 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -31,6 +31,7 @@ import { errorMessages } from "@/constants/error-messages"; import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin"; import { useMainStore } from "@/store"; import { issPageValues } from "@/router/router-constants/issPage-values"; +import BaseFormMixin from '@/mixins/base-form-mixin.js'; // Import Component import { Form } from "vee-validate"; @@ -41,7 +42,7 @@ defineRule("questions-required", required(errorMessages.OPTION_REQUIRED)); export default { name: "molding-questions", - mixins: [vehicleQuestionsMixin], + mixins: [BaseFormMixin, vehicleQuestionsMixin], async beforeRouteEnter(to, from, next) { const cmsContentPromise = fetchCmsContentForPage(to.query.issPage); @@ -163,6 +164,7 @@ export default { }, ]; } + this.navigateForward(partsOrQuestions, null); }, }, From a7e3c8b66905ddcaf3ae1d40008e2ece4d396bf7 Mon Sep 17 00:00:00 2001 From: Kroell Date: Thu, 9 Feb 2023 15:03:11 -0500 Subject: [PATCH 06/19] start of unit tests for molding-questions --- .../molding-questions.spec.js | 331 ++++++++++++++++++ 1 file changed, 331 insertions(+) create mode 100644 src/layouts/molding-questions/molding-questions.spec.js diff --git a/src/layouts/molding-questions/molding-questions.spec.js b/src/layouts/molding-questions/molding-questions.spec.js new file mode 100644 index 00000000..ba3d5438 --- /dev/null +++ b/src/layouts/molding-questions/molding-questions.spec.js @@ -0,0 +1,331 @@ +// Components +import moldingQuestions from "@/layouts/molding-questions/molding-questions"; + +// Supporting Files +import { shallowMount } from "@vue/test-utils"; +import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import { useMainStore } from "@/store"; +import baseMixin from "../../mixins/base-mixin"; +import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin"; +import { nextTick } from "vue"; + +// Mock our module for promises. +jest.mock("@/helpers/layout-helper.js", () => ({ + settleAllPromises: jest.fn(), +})); + +// Mock fetchCmsContentForPage +jest.mock("@/helpers/cms-content-helper", () => ({ + fetchCmsContentForPage: jest.fn(), +})); + +const baseStoreGettersPageData = () => { + return { + partsOrQuestions: [ + { + parts: [ + { + 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, + }, + ], + }, + ], + basePartNumber: "DW01105", + color: "Green Tint, Blue Shade", + requiresRecalibration: false, + recalibrationType: "", + canSafeliteRecalibrate: false, + requiresCapabilityQuestions: false, + childParts: null, + partNumber: "DW01105GBNN", + description: "solar", + partType: "WINDSHIELD", + }, + ], + partQuestions: [], + glassLocation: "Windshield", + glassName: "Single", + answerKey: "Windshield-Single", + answerData: null, + }, + ], + }; +}; +const baseStoreGettersDamage = () => { + return { + partsQuestionAnswers: [ + { + glassLocation: "Windshield", + glassName: "Single", + result: "FW04848", + answeredQuestions: [ + { + 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, + }, + ], + }, + ], + }; +}; + +useMainStore().pageData = baseStoreGettersDamage; +useMainStore().damage = baseStoreGettersDamage; + +describe("moldingQuestions.vue", () => { + describe("method arePagePrerequisitesValid...", () => { + test("Should return true for valid page requisites if pageData exists", () => { + // Arrange + const { wrapper } = setupMocks({}); + + // Act + const result = wrapper.vm.arePagePrerequisitesValid(); + + //Assert + expect(result).toBe(true); + + wrapper.unmount(); + }); + + test("Should return false for valid page requisites if partsOrQuestions in pageData is missing", () => { + // Arrange + const { wrapper } = setupMocks({}); + store.getters.pageData = jest.fn(() => { + return undefined; + }); + + // Act + const result = wrapper.vm.arePagePrerequisitesValid(); + + //Assert + expect(result).toBeFalsy(); + + wrapper.unmount(); + }); + + test("Should be at least one item in partsOrQuestions", () => { + // Arrange + store.getters = { + pageData: jest.fn(() => { + return { + partsOrQuestions: [], + }; + }), + damage: baseStoreGettersDamage, + }; + const { wrapper } = setupMocks({}); + + // Act + const result = wrapper.vm.arePagePrerequisitesValid(); + + //Assert + expect(result).toBeFalsy(); + + wrapper.unmount(); + }); + }); + + describe("watch on selectedAnswers should be set up...", () => { + test("Should trigger handleCompletedQuestionChainAnswers if watched data changes", async () => { + // Arrange + const { wrapper } = setupMocks({}); + const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers"); + + // Act + wrapper.setData({ + selectedAnswers: { + "Windshield-Single": { + answerResult: "FW04848", + answeredQuestions: [ + { + 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, + }, + ], + index: 0, + }, + }, + }); + + await nextTick(); + + //Assert + expect(spy).toHaveBeenCalled(); + + wrapper.unmount(); + }); + }); + +// describe("forwardButtonAction", () => { +// test("Should clear out answerData", () => { +// // Arrange +// const { wrapper } = setupMocks({}); + +// wrapper.vm.questionsData = [ +// { +// glassLocation: "Windshield", +// glassName: "Single", +// answerData: { +// answerResult: "FW04848", +// answeredQuestions: [], +// }, +// }, +// ]; +// wrapper.vm.dispatchStoreAction = jest.fn(() => { +// return { +// data: { +// glassPieceParts: [], +// }, +// }; +// }); + +// // Act +// wrapper.vm.forwardButtonAction(); + +// //Assert +// expect(wrapper.vm.questionsData[0].answerData).toEqual({}); + +// wrapper.unmount(); +// }); + +// test("Should save to Vuex store", async () => { +// // Arrange +// const { wrapper } = setupMocks({}); + +// wrapper.vm.questionsData = [ +// { +// glassLocation: "Windshield", +// glassName: "Single", +// answerData: { +// answerResult: "FW04848", +// answeredQuestions: [], +// }, +// }, +// ]; +// wrapper.vm.dispatchStoreAction = jest.fn(() => { +// return { +// data: { +// glassPieceParts: [], +// }, +// }; +// }); +// const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction"); + +// // Act +// wrapper.vm.forwardButtonAction(); + +// await nextTick(); + +// //Assert +// expect(spy).toHaveBeenNthCalledWith( +// 1, +// "saveMoldingQuestionAnswers", +// [ +// { +// answeredQuestions: [], +// glassLocation: "Windshield", +// glassName: "Single", +// isSuppressedPart: undefined, +// partNum: "FW04848", +// }, +// ], +// false +// ); + +// wrapper.unmount(); +// }); + +// test("Should trigger navigateForward", async () => { +// // Arrange +// const { wrapper } = setupMocks({}); + +// wrapper.vm.questionsData = [ +// { +// glassLocation: "Windshield", +// glassName: "Single", +// answerData: { +// answerResult: "FW04848", +// answeredQuestions: [], +// }, +// }, +// ]; +// wrapper.vm.dispatchStoreAction = jest.fn(() => { +// return { +// data: { +// glassPieceParts: [], +// }, +// }; +// }); +// wrapper.vm.navigateForward = jest.fn(); + +// // Act +// await wrapper.vm.forwardButtonAction(); + +// //Assert +// expect(wrapper.vm.navigateForward).toHaveBeenCalled(); + +// wrapper.unmount(); +// }); +// }); + }); + +function setupMocks({ + mountOptionsMockData = { + router: { + navigate: jest.fn(), + }, + store: { + getters: store.getters, + commit: store.commit, + }, + route: { + query: { + issPage: "molding-questions", + }, + }, + }, +}) { + const mountOptions = getMountOptions({ + ...mountOptionsMockData, + mixins: [baseMixin, vehicleQuestionsMixin], + }); + mountOptions["attachTo"] = document.body; + + const wrapper = shallowMount(moldingQuestions, mountOptions); + + return { wrapper }; +} \ No newline at end of file From e9bcab540239e5978a505ec6919ac9dba2a32f6c Mon Sep 17 00:00:00 2001 From: Kroell Date: Thu, 9 Feb 2023 16:49:08 -0500 Subject: [PATCH 07/19] typo fix --- src/layouts/molding-questions/molding-questions.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index e3c6c13e..e06dfe58 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -86,7 +86,7 @@ export default { this.getInitialQuestionData(); }, methods: { - arePagePrerequisiteValid() { + arePagePrerequisitesValid() { const moldingQuestionsFromPageData = useMainStore().pageData( issPageValues.MOLDING_QUESTIONS ); From 9a536d2886c8b3a506ffc1e46d10788675e65cb0 Mon Sep 17 00:00:00 2001 From: Kroell Date: Thu, 9 Feb 2023 16:49:29 -0500 Subject: [PATCH 08/19] completed unit tests for molding-questions --- .../molding-questions.spec.js | 281 +++++++++++------- 1 file changed, 169 insertions(+), 112 deletions(-) diff --git a/src/layouts/molding-questions/molding-questions.spec.js b/src/layouts/molding-questions/molding-questions.spec.js index ba3d5438..ee5a11b1 100644 --- a/src/layouts/molding-questions/molding-questions.spec.js +++ b/src/layouts/molding-questions/molding-questions.spec.js @@ -93,7 +93,7 @@ const baseStoreGettersDamage = () => { }; }; -useMainStore().pageData = baseStoreGettersDamage; +useMainStore().pageData = baseStoreGettersPageData; useMainStore().damage = baseStoreGettersDamage; describe("moldingQuestions.vue", () => { @@ -114,7 +114,7 @@ describe("moldingQuestions.vue", () => { test("Should return false for valid page requisites if partsOrQuestions in pageData is missing", () => { // Arrange const { wrapper } = setupMocks({}); - store.getters.pageData = jest.fn(() => { + useMainStore().pageData = jest.fn(() => { return undefined; }); @@ -129,14 +129,13 @@ describe("moldingQuestions.vue", () => { test("Should be at least one item in partsOrQuestions", () => { // Arrange - store.getters = { - pageData: jest.fn(() => { - return { - partsOrQuestions: [], - }; - }), - damage: baseStoreGettersDamage, - }; + useMainStore().pageData = jest.fn(() => { + return { + partsOrQuestions: [], + }; + }); + useMainStore().damage = baseStoreGettersDamage; + const { wrapper } = setupMocks({}); // Act @@ -150,10 +149,13 @@ describe("moldingQuestions.vue", () => { }); describe("watch on selectedAnswers should be set up...", () => { - test("Should trigger handleCompletedQuestionChainAnswers if watched data changes", async () => { + test("Should trigger handleAnswerUpdates if watched data changes", async () => { // Arrange + useMainStore().pageData = baseStoreGettersPageData; + useMainStore().damage = baseStoreGettersDamage; + const { wrapper } = setupMocks({}); - const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers"); + const spy = jest.spyOn(wrapper.vm, "handleAnswerUpdates"); // Act wrapper.setData({ @@ -190,135 +192,190 @@ describe("moldingQuestions.vue", () => { }); }); -// describe("forwardButtonAction", () => { -// test("Should clear out answerData", () => { -// // Arrange -// const { wrapper } = setupMocks({}); + describe("forwardButtonAction", () => { + test("Should clear out answerData", () => { + // Arrange + const { wrapper } = setupMocks({}); -// wrapper.vm.questionsData = [ -// { -// glassLocation: "Windshield", -// glassName: "Single", -// answerData: { -// answerResult: "FW04848", -// answeredQuestions: [], -// }, -// }, -// ]; -// wrapper.vm.dispatchStoreAction = jest.fn(() => { -// return { -// data: { -// glassPieceParts: [], -// }, -// }; -// }); + wrapper.vm.questionsData = [ + { + glassLocation: "Windshield", + glassName: "Single", + answerData: { + answerResult: "FW04848", + answeredQuestions: [], + }, + }, + ]; + wrapper.vm.dispatchStoreAction = jest.fn(() => { + return { + data: { + partsOrQuestions: [], + }, + }; + }); -// // Act -// wrapper.vm.forwardButtonAction(); + // Act + wrapper.vm.forwardButtonAction(); -// //Assert -// expect(wrapper.vm.questionsData[0].answerData).toEqual({}); + //Assert + expect(wrapper.vm.questionsData[0].answerData).toEqual({}); -// wrapper.unmount(); -// }); + wrapper.unmount(); + }); -// test("Should save to Vuex store", async () => { -// // Arrange -// const { wrapper } = setupMocks({}); + test("Should save to pinia store", async () => { + // Arrange + const { wrapper } = setupMocks({}); -// wrapper.vm.questionsData = [ -// { -// glassLocation: "Windshield", -// glassName: "Single", -// answerData: { -// answerResult: "FW04848", -// answeredQuestions: [], -// }, -// }, -// ]; -// wrapper.vm.dispatchStoreAction = jest.fn(() => { -// return { -// data: { -// glassPieceParts: [], -// }, -// }; -// }); -// const spy = jest.spyOn(wrapper.vm, "dispatchStoreAction"); + wrapper.vm.questionsData = [ + { + glassLocation: "Windshield", + glassName: "Single", + answerData: { + answerResult: "FW04848", + answeredQuestions: [], + }, + }, + ]; + useMainStore().getPartsOrQuestions = jest.fn(() => { + return { + data: { + partsOrQuestions: [], + }, + }; + }); -// // Act -// wrapper.vm.forwardButtonAction(); + // Act + wrapper.vm.forwardButtonAction(); -// await nextTick(); + await nextTick(); -// //Assert -// expect(spy).toHaveBeenNthCalledWith( -// 1, -// "saveMoldingQuestionAnswers", -// [ -// { -// answeredQuestions: [], -// glassLocation: "Windshield", -// glassName: "Single", -// isSuppressedPart: undefined, -// partNum: "FW04848", -// }, -// ], -// false -// ); + //Assert + expect(wrapper.vm.saveMoldingQuestionAnswers).toHaveBeenCalled; + wrapper.unmount(); + }); -// wrapper.unmount(); -// }); + test("Should call GET_PARTS_OR_QUESTIONS API", async () => { + // Arrange + const { wrapper } = setupMocks({}); -// test("Should trigger navigateForward", async () => { -// // Arrange -// const { wrapper } = setupMocks({}); + wrapper.vm.questionsData = [ + { + glassLocation: "Windshield", + glassName: "Single", + answerData: { + answerResult: "FW04848", + answeredQuestions: [], + }, + }, + ]; + useMainStore().getPartsOrQuestions = jest.fn(() => { + return { + data: { + partsOrQuestions: [], + }, + }; + }); -// wrapper.vm.questionsData = [ -// { -// glassLocation: "Windshield", -// glassName: "Single", -// answerData: { -// answerResult: "FW04848", -// answeredQuestions: [], -// }, -// }, -// ]; -// wrapper.vm.dispatchStoreAction = jest.fn(() => { -// return { -// data: { -// glassPieceParts: [], -// }, -// }; -// }); -// wrapper.vm.navigateForward = jest.fn(); + // Act + wrapper.vm.forwardButtonAction(); -// // Act -// await wrapper.vm.forwardButtonAction(); + await nextTick(); -// //Assert -// expect(wrapper.vm.navigateForward).toHaveBeenCalled(); + //Assert + expect(wrapper.vm.getPartsOrQuestions).toHaveBeenCalled; -// wrapper.unmount(); -// }); -// }); + wrapper.unmount(); + }); + + test("Should trigger navigateForward", async () => { + // Arrange + const { wrapper } = setupMocks({}); + + wrapper.vm.questionsData = [ + { + glassLocation: "Windshield", + glassName: "Single", + answerData: { + answerResult: "FW04848", + answeredQuestions: [], + }, + }, + ]; + useMainStore().getPartsOrQuestions = jest.fn(() => { + return { + data: { + partsOrQuestions: [], + }, + }; + }); + wrapper.vm.navigateForward = jest.fn(); + + // Act + await wrapper.vm.forwardButtonAction(); + + //Assert + expect(wrapper.vm.navigateForward).toHaveBeenCalled(); + + wrapper.unmount(); + }); }); +}); function setupMocks({ mountOptionsMockData = { router: { navigate: jest.fn(), }, - store: { - getters: store.getters, - commit: store.commit, - }, + actionList: [ + { + actionName: "saveMoldingQuestionAnswers", + data: {}, + }, + { + actionName: "getPartsOrQuestions", + data: {}, + }, + ], route: { query: { issPage: "molding-questions", }, }, + data() { + return { + computedSwitcher: [ + { + glassLocation: "Windshield", + glassName: "Single", + answerData: { + answerResult: "FW04848", + answeredQuestions: [], + }, + }, + ], + }; + }, + questionsData: { + get() { + return this.computedSwitcher; + }, + set(val) { + this.computedSwitcher = val; + }, + }, }, }) { + + useMainStore().getPartsOrQuestions = jest.fn(() => { + return { + data: { + partsOrQuestions: [], + } + }; + }); + const mountOptions = getMountOptions({ ...mountOptionsMockData, mixins: [baseMixin, vehicleQuestionsMixin], From 89c029b41dd8bfa5195d0b258dbaac7bf21fbf17 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 13 Feb 2023 09:19:25 -0500 Subject: [PATCH 09/19] spacing fix --- src/layouts/policy-holder-details/policy-holder-details.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index 76702d8b..9e43261d 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -4,7 +4,7 @@
- +
\ No newline at end of file From c7f7995ad34fa85417fc3e0c74f5a1be580e8e0c Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 13 Feb 2023 10:37:47 -0500 Subject: [PATCH 10/19] policy-holder-details: styling fixes for font-size, line-height, and color --- .../policy-holder-details.vue | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index 9e43261d..dc98e414 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -3,8 +3,8 @@
- - + +
\ No newline at end of file From 04b3ab2157d34605e652366ec20ce5c5cfab3c1c Mon Sep 17 00:00:00 2001 From: katie Date: Mon, 13 Feb 2023 10:53:20 -0500 Subject: [PATCH 11/19] Revert "spacing fix" This reverts commit 89c029b41dd8bfa5195d0b258dbaac7bf21fbf17. --- .../policy-holder-details.vue | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index dc98e414..76702d8b 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -3,8 +3,8 @@
- - + +
\ No newline at end of file From d2474d059d638558b634bff80a20a2bea853ced1 Mon Sep 17 00:00:00 2001 From: katie Date: Mon, 13 Feb 2023 10:58:02 -0500 Subject: [PATCH 12/19] Revert commit From 728f7d35ac81882146e506fb3f1fb4cd223d2e87 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 13 Feb 2023 11:14:04 -0500 Subject: [PATCH 13/19] SSR-255: changes to font size, line height, and font color --- .../policy-holder-details/policy-holder-details.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index 76702d8b..79b2c584 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -3,7 +3,7 @@
- +
@@ -141,4 +141,10 @@ export default { { margin-top: 20px; } + +#sub-header p { + font-size: 16px; + line-height: 26px; + color: #4D5151; +} \ No newline at end of file From eb78ede3a6d47c78af8478c7fcdf2e5a56ee7622 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 13 Feb 2023 11:16:14 -0500 Subject: [PATCH 14/19] SSR-256: changes to margin-top spacing --- src/layouts/policy-holder-details/policy-holder-details.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index 79b2c584..564a8049 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -4,7 +4,7 @@
- +
\ No newline at end of file From 0fcdbf92a2271fd92031256e12db892e48b1f484 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 13 Feb 2023 11:45:15 -0500 Subject: [PATCH 15/19] SSR-265: changes to line-height on alert --- src/layouts/policy-holder-details/policy-holder-details.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index 564a8049..32f0aea9 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -151,4 +151,8 @@ export default { #address-questions-wrapper { margin-top: 24px; } + +#address-questions-wrapper .alert.heading { + line-height: 24px; +} \ No newline at end of file From 03e525c8e81a12176d0be1d1a041b38cee4b4470 Mon Sep 17 00:00:00 2001 From: Kroell Date: Mon, 13 Feb 2023 13:34:52 -0500 Subject: [PATCH 16/19] SSR-263: change to line-height on field error messages --- src/layouts/policy-holder-details/policy-holder-details.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/layouts/policy-holder-details/policy-holder-details.vue b/src/layouts/policy-holder-details/policy-holder-details.vue index 32f0aea9..bacb5059 100644 --- a/src/layouts/policy-holder-details/policy-holder-details.vue +++ b/src/layouts/policy-holder-details/policy-holder-details.vue @@ -155,4 +155,8 @@ export default { #address-questions-wrapper .alert.heading { line-height: 24px; } + +#address-questions-wrapper .form-test-error { + line-height: 24px; +} \ No newline at end of file From def94c927506fdba72af1fbf4f28eec7296fa844 Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Mon, 13 Feb 2023 15:40:52 -0500 Subject: [PATCH 17/19] Create CSM entries and markup for coverage statement page. Remove hard-coded margin-bottom from vehicleBanner and replace it at the component level. "Recalibration" link at bottom of page is for testing only and will be removed when textLink functionality is added to the CMS. --- .../text-block/text-block.vue | 5 +- .../questions-page-layout.vue | 2 +- .../vehicle-banner/vehicle-banner.vue | 6 +- src/layouts/address-lookup/address-lookup.vue | 9 +-- .../address-vehicles/address-vehicles.vue | 3 +- .../capability-questions.vue | 9 +-- .../coverage-statement/coverage-statement.vue | 58 ++++++++++++++----- .../license-plate-lookup.vue | 17 +++--- src/layouts/vehicle-damage/vehicle-damage.vue | 11 ++-- src/layouts/vehicle-lookup/vehicle-lookup.vue | 1 + src/layouts/vehicle-make/vehicle-make.vue | 28 ++++----- src/layouts/vehicle-model/vehicle-model.vue | 21 ++++--- src/layouts/vehicle-parts/vehicle-parts.vue | 1 + src/layouts/vehicle-style/vehicle-style.vue | 8 +-- src/layouts/vehicle-year/vehicle-year.vue | 33 +++++------ src/layouts/vin-lookup/vin-lookup.vue | 41 ++++++------- src/layouts/welcome-page/welcome-page.vue | 2 +- src/styles/common-typography-styles.scss | 4 +- 18 files changed, 150 insertions(+), 109 deletions(-) diff --git a/src/digital-components/text-block/text-block.vue b/src/digital-components/text-block/text-block.vue index 33854e14..d042113e 100644 --- a/src/digital-components/text-block/text-block.vue +++ b/src/digital-components/text-block/text-block.vue @@ -1,6 +1,6 @@ @@ -25,12 +25,15 @@ export default { \ No newline at end of file + diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index d25d958a..23ba630f 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -11,6 +11,7 @@ - -
-

Placeholder for coverage-statement page

- +
+ + + + + Recalibration + + + diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index cba7bf6a..a3896f85 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -1,11 +1,12 @@ - - + - \ No newline at end of file diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 06780711..61415037 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -3,6 +3,7 @@
diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue index e8b3e942..893de9d0 100644 --- a/src/layouts/vehicle-style/vehicle-style.vue +++ b/src/layouts/vehicle-style/vehicle-style.vue @@ -3,7 +3,7 @@
- +
-
@@ -65,7 +65,7 @@ export default { ]; const resultMap = await settleAllPromises(promiseResultMap); - + const visitedVehicleDamage = useMainStore().pageData(issPageValues.VEHICLE_DAMAGE) ? true : false; // If we have exactly one style then navigate directly to vehicle-damage @@ -117,7 +117,7 @@ export default { }, computed: { - backButtonAccessibleText() + backButtonAccessibleText() { return this.getCmsContent(this.cmsWidgetName, "BackButtonAccessibleText") } diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 598e4728..10ea7b52 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -3,23 +3,23 @@
- +
-
-
- + - \ No newline at end of file diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index d3751f1f..c54c2b7e 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -9,6 +9,7 @@ cmsWidgetName="SiteHeaderWidget" /> @@ -82,7 +83,7 @@ export default { activeVehicleLookupAlertType: null, needToLookupVehicle: true, vehicleFromLookup: null, - vin: null, + vin: null, }; }, provide() { @@ -130,7 +131,7 @@ export default { this.resetActiveAlert(); // Temp solution to reset the 'disabled' style on the Continue button this.$refs.siteFooter.enableForwardAction(); - + if (this.needToLookupVehicle) { const vehicleLookupResponse = await this.lookupVehicleByVin(this.vin); @@ -146,29 +147,29 @@ export default { } // Add vin bcs the response from the service doesn't contain vin - this.vehicleFromLookup = Object.assign(vehicleLookupResponse.data, { vin: this.vin }); + this.vehicleFromLookup = Object.assign(vehicleLookupResponse.data, { vin: this.vin }); } - if (this.needToLookupVehicle && this.isCarIdDifferentFromTheStore) { - this.activeVehicleLookupAlertType = vehicleLookupAlertTypes.NOT_MATCHED; - + if (this.needToLookupVehicle && this.isCarIdDifferentFromTheStore) { + this.activeVehicleLookupAlertType = vehicleLookupAlertTypes.NOT_MATCHED; + const vehicleYearMakeModel = `${this.vehicleFromLookup.year} ${this.vehicleFromLookup.make} ${this.vehicleFromLookup.model}`; this.$refs.siteFooter.updateButtonText(`Continue with ${vehicleYearMakeModel}`); this.$refs.siteFooter.removeLoader(); - + this.needToLookupVehicle = false; return; } - let isSelectedGlassAvailableForVehicle = true; - if (this.isCarIdDifferentFromTheStore) { - isSelectedGlassAvailableForVehicle = - await isGlassAvailableForCarId(this.vehicleFromLookup.carId); - } - + let isSelectedGlassAvailableForVehicle = true; + if (this.isCarIdDifferentFromTheStore) { + isSelectedGlassAvailableForVehicle = + await isGlassAvailableForCarId(this.vehicleFromLookup.carId); + } + // navigate back to vehicle-damage - if (this.isCarIdDifferentFromTheStore && !isSelectedGlassAvailableForVehicle) { + if (this.isCarIdDifferentFromTheStore && !isSelectedGlassAvailableForVehicle) { this.mainStore.updateVehicle(this.vehicleFromLookup); this.$router.navigate( this.navigationScenarios.SELECTED_VIN_WITH_MISMATCHED_GLASS, @@ -179,8 +180,8 @@ export default { // navigate() doesn't stop the processing flow return; - } - + } + this.mainStore.updateVehicle(this.vehicleFromLookup); const partsOrQuestionsResponse = await this.getPartsOrQuestions(); if (partsOrQuestionsResponse.error) { @@ -194,7 +195,7 @@ export default { await this.navigateForward(partsOrQuestionsResponse.data.partsOrQuestions, this); }, async getPartsOrQuestions() { - try { + try { const response = await this.mainStore.getPartsOrQuestions(); return response; @@ -209,15 +210,15 @@ export default { async lookupVehicleByVin(vin) { try { return await this.mainStore.lookupVehicleByVin(vin); - } - catch (responseError) { + } + catch (responseError) { return { error: { status: responseError.status, }, }; } - }, + }, resetActiveAlert() { this.activeVehicleLookupAlertType = null; }, diff --git a/src/layouts/welcome-page/welcome-page.vue b/src/layouts/welcome-page/welcome-page.vue index c527d65f..79aef739 100644 --- a/src/layouts/welcome-page/welcome-page.vue +++ b/src/layouts/welcome-page/welcome-page.vue @@ -34,7 +34,7 @@
- +
diff --git a/src/styles/common-typography-styles.scss b/src/styles/common-typography-styles.scss index 9ee9aa28..a593092e 100644 --- a/src/styles/common-typography-styles.scss +++ b/src/styles/common-typography-styles.scss @@ -25,7 +25,7 @@ h4,.h4 { font-weight: 300; } h5,.h5 { - line-height: 1.325; + line-height: 1.6; font-weight: 400; } h6,.h6 { @@ -64,4 +64,4 @@ caption, font-size: 1rem !important; line-height: 1.4; font-weight: 500; -} \ No newline at end of file +} From e8e88133a80546e5168e617dbe398a0b2843d9bf Mon Sep 17 00:00:00 2001 From: Bryan Mauger Date: Tue, 14 Feb 2023 11:10:46 -0500 Subject: [PATCH 18/19] Update font size/weight. --- src/layouts/coverage-statement/coverage-statement.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/layouts/coverage-statement/coverage-statement.vue b/src/layouts/coverage-statement/coverage-statement.vue index 6c38f0ff..e73ff61b 100644 --- a/src/layouts/coverage-statement/coverage-statement.vue +++ b/src/layouts/coverage-statement/coverage-statement.vue @@ -27,8 +27,7 @@ /> Date: Thu, 16 Feb 2023 16:19:48 -0500 Subject: [PATCH 19/19] fix to save vin to store correctly so getPartsOrQuestions can use vin --- src/layouts/license-plate-lookup/license-plate-lookup.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue index a3896f85..404a8785 100644 --- a/src/layouts/license-plate-lookup/license-plate-lookup.vue +++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue @@ -194,7 +194,7 @@ export default { await useMainStore().saveRegistrationLicensePlateLookup( { isSelectedGlassAvailableForVehicle: this.isSelectedGlassAvailableForVehicle, - vehicleInfo: Object.assign(vehicleFromLookup, {vin: vehicleFromLookup.vin }), + vehicleInfo: Object.assign(vinLookupResponse.data.vehicle, { vin: vinLookupResponse.data.vin }), registrationInfo: { licensePlate: this.licensePlate, state: this.licenseState,