diff --git a/src/helpers/damage-helper.js b/src/helpers/damage-helper.js index 55d10738d..ed353e51b 100644 --- a/src/helpers/damage-helper.js +++ b/src/helpers/damage-helper.js @@ -19,7 +19,7 @@ export function getDamageString() { if (damageLocations.length > 1) { returnString = "match" } else { - switch(damageLocations[0]?.location) { + switch(damageLocations[0]?.glassLocation) { case "Windshield": returnString = "windshield" break; @@ -36,7 +36,7 @@ export function getDamageString() { export function getIsWindshieldOnly () { const damageLocations = store.getters.damage.glassToReplace; - const returnString = damageLocations.length === 1 && damageLocations[0]?.location === "Windshield" ? "windshield" : "glass"; + const returnString = damageLocations.length === 1 && damageLocations[0]?.glassLocation === "Windshield" ? "windshield" : "glass"; return returnString; } @@ -56,7 +56,7 @@ export async function isGlassAvailableForCarId(carId){ } for(const option of currentGlassOptions){ - if(!newGlassOptions.data[optionsMap[option.location]].availableReplacementOptions.includes(option.name)){ + if(!newGlassOptions.data[optionsMap[option.glassLocation]].availableReplacementOptions.includes(option.glassName)){ return false; } } diff --git a/src/helpers/damage-helper.spec.js b/src/helpers/damage-helper.spec.js index 2a46978dc..210bf96cc 100644 --- a/src/helpers/damage-helper.spec.js +++ b/src/helpers/damage-helper.spec.js @@ -16,7 +16,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({ it("Should return match when multiple selected damage options are in the store", () => { // Arrange / Act - store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}, {location: "Passenger", name: "sideWindow"}]; + store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "windshield"}, {glassLocation: "Passenger", glassName: "sideWindow"}]; const damage = getDamageString(); @@ -29,7 +29,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({ it("Should return windshield when Windshield is the only selected damage option in the store", () => { // Arrange / Act - store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}]; + store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "windshield"}]; const damage = getDamageString(); @@ -42,7 +42,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({ it("Should return side window when Driver or Passenger is the only selected damage option in the store", () => { // Arrange / Act - store.getters.damage.glassToReplace = [{location: "Passenger", name: "sideWindow"}]; + store.getters.damage.glassToReplace = [{glassLocation: "Passenger", glassName: "sideWindow"}]; const damage = getDamageString(); @@ -55,7 +55,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({ it("Should return rear window when Rear is the only selected damage option in the store", () => { // Arrange / Act - store.getters.damage.glassToReplace = [{location: "Rear", name: "rear"}]; + store.getters.damage.glassToReplace = [{glassLocation: "Rear", glassName: "rear"}]; const damage = getDamageString(); @@ -67,7 +67,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({ describe("damage-helper.js", () => { it("Should return true if no mismatches between each array exist", async () => { // Arrange - store.getters.damage.glassToReplace = [{location: "Windshield", name: "windshield"}]; + store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "windshield"}]; // Act const isGlassAvailable = await isGlassAvailableForCarId(); @@ -80,7 +80,7 @@ jest.mock("@/mixins/base-mixin.js", () => ({ describe("damage-helper.js", () => { it("Should return false if any mismatches between each array exist", async () => { // Arrange - store.getters.damage.glassToReplace = [{location: "Windshield", name: "sideWindow"}]; + store.getters.damage.glassToReplace = [{glassLocation: "Windshield", glassName: "sideWindow"}]; const isGlassAvailable = await isGlassAvailableForCarId(); diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index 6491a76df..187f02fe1 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -11,7 +11,7 @@ v-bind:isDismissible="false" />
@@ -86,7 +86,7 @@ export default { return this.getCmsContent("AdditionalPartsQuestionsAlert", "BodyText"); }, windshieldPart() { - return this.pageData.partsOrQuestions.find(x => x.location === damageLocationsSelected.WINDSHIELD); + return this.pageData.partsOrQuestions.find(x => x.glassLocation === damageLocationsSelected.WINDSHIELD); }, windshieldPartInfo() { return this.windshieldPart.parts[0]; @@ -122,8 +122,8 @@ export default { const selectedAnswerResult2 = this.getCorrespondingAnswerResult2(glass.answerData.answerResult); return { - location: glass.location, - name: glass.name, + glassLocation: glass.glassLocation, + glassName: glass.glassName, result: glass.answerData.answerResult, result1: glass.answerData.answerResult, result2: selectedAnswerResult2, @@ -143,8 +143,8 @@ export default { // get parts from the capabilityQuestionAnswers let partsOrQuestions = this.pageData.partsOrQuestions; for (let answer of capabilityQuestionsAnswersArray) { - const correspondingPart = partsOrQuestions.find(partOrQuestion => partOrQuestion.location === answer.location); - const partFromCapabilityQuestionAnswer = (await this.dispatchStoreAction(storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER, answer.location, false)).data; + const correspondingPart = partsOrQuestions.find(partOrQuestion => partOrQuestion.glassLocation === answer.glassLocation); + const partFromCapabilityQuestionAnswer = (await this.dispatchStoreAction(storeActions.GET_PART_FROM_CAPABILITY_QUESTION_ANSWER, answer.glassLocation, false)).data; partsOrQuestions.find(partOrQuestion => partOrQuestion.location === answer.location).parts = partFromCapabilityQuestionAnswer; } @@ -239,7 +239,7 @@ export default { }); // Update the key to re-render this part's question-chain component - this.capabilityQuestionsData[gpIndex].key = this.capabilityQuestionsData[gpIndex].location + this.capabilityQuestionsData[gpIndex].name + Date.now().toString(); + this.capabilityQuestionsData[gpIndex].key = this.capabilityQuestionsData[gpIndex].glassLocation + this.capabilityQuestionsData[gpIndex].glassName + Date.now().toString(); // handle suppressing downstream in this question chain @@ -325,7 +325,7 @@ export default { }); // Update the key to re-render this part's question-chain component - this.capabilityQuestionsData[gpIndex].key = this.capabilityQuestionsData[gpIndex].location + this.capabilityQuestionsData[gpIndex].name + Date.now().toString(); + this.capabilityQuestionsData[gpIndex].key = this.capabilityQuestionsData[gpIndex].glassLocation + this.capabilityQuestionsData[gpIndex].glassName + Date.now().toString(); } }); diff --git a/src/layouts/molding-questions/molding-questions.vue b/src/layouts/molding-questions/molding-questions.vue index c73c6e5e1..50cfe42c2 100644 --- a/src/layouts/molding-questions/molding-questions.vue +++ b/src/layouts/molding-questions/molding-questions.vue @@ -23,7 +23,7 @@
{ return { - location: glass.location, - name: glass.name, + glassLocation: glass.glassLocation, + glassName: glass.glassName, partNum: glass.answerData.answerResult, answeredQuestions: glass.answerData.answeredQuestions, isSuppressedPart: glass.isSuppressedPart, @@ -152,7 +152,7 @@ export default { let partsOrQuestions = this.pageData.partsOrQuestions; for (let answer of questionAnswersArray) { partsOrQuestions.find(partOrQuestion => { - return partOrQuestion.location === answer.location && partOrQuestion.name === answer.name; + return partOrQuestion.glassLocation === answer.glassLocation && partOrQuestion.glassName === answer.glassName; }).parts[0].childParts = [ { partNumber: answer.partNum @@ -250,7 +250,7 @@ export default { }); // Update the key to re-render this part's question-chain component - this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].location + this.moldingQuestionsData[gpIndex].name + Date.now().toString(); + this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString(); // handle suppressing downstream in this question chain @@ -336,7 +336,7 @@ export default { }); // Update the key to re-render this part's question-chain component - this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].location + this.moldingQuestionsData[gpIndex].name + Date.now().toString(); + this.moldingQuestionsData[gpIndex].key = this.moldingQuestionsData[gpIndex].glassLocation + this.moldingQuestionsData[gpIndex].glassName + Date.now().toString(); } diff --git a/src/layouts/part-questions/part-questions.vue b/src/layouts/part-questions/part-questions.vue index 0b0cc0165..7423cb6bb 100644 --- a/src/layouts/part-questions/part-questions.vue +++ b/src/layouts/part-questions/part-questions.vue @@ -23,7 +23,7 @@
{ return { - location: glass.location, - name: glass.name, + glassLocation: glass.glassLocation, + glassName: glass.glassName, result: glass.answerData.answerResult, answeredQuestions: glass.answerData.answeredQuestions, isSuppressedPart: glass.isSuppressedPart, @@ -246,7 +246,7 @@ export default { }); // Update the key to re-render this part's question-chain component - this.partsQuestionsData[gpIndex].key = this.partsQuestionsData[gpIndex].location + this.partsQuestionsData[gpIndex].name + Date.now().toString(); + this.partsQuestionsData[gpIndex].key = this.partsQuestionsData[gpIndex].glassLocation + this.partsQuestionsData[gpIndex].glassName + Date.now().toString(); // handle suppressing downstream in this question chain @@ -332,7 +332,7 @@ export default { }); // Update the key to re-render this part's question-chain component - this.partsQuestionsData[gpIndex].key = this.partsQuestionsData[gpIndex].location + this.partsQuestionsData[gpIndex].name + Date.now().toString(); + this.partsQuestionsData[gpIndex].key = this.partsQuestionsData[gpIndex].glassLocation + this.partsQuestionsData[gpIndex].glassName + Date.now().toString(); } diff --git a/src/layouts/vehicle-damage/vehicle-damage.spec.js b/src/layouts/vehicle-damage/vehicle-damage.spec.js index cc6d9011f..4cf6b87c0 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.spec.js +++ b/src/layouts/vehicle-damage/vehicle-damage.spec.js @@ -81,8 +81,8 @@ describe("vehicle-damage.vue", () => { //Arrange const partsData = { partsOrQuestions: [{ - name: "Single", - location: "Windshield", + glassName: "Single", + glassLocation: "Windshield", parts: null, partQuestions: [{ questionSequence: 1, @@ -144,8 +144,8 @@ describe("vehicle-damage.vue", () => { selectedRearReplaceOptions: "Stationary", }) - const expectedGlassToReplace = [{ location: "Windshield", name: "Single" }, { location: "Driver", name: "Back" }, - { location: "Passenger", name: "Quarter" }, { location: "Rear", name: "Stationary" }]; + const expectedGlassToReplace = [{ glassLocation: "Windshield", glassName: "Single" }, { glassLocation: "Driver", glassName: "Back" }, + { glassLocation: "Passenger", glassName: "Quarter" }, { glassLocation: "Rear", glassName: "Stationary" }]; //Act vehicleDamage.beforeRouteEnter.call( @@ -168,8 +168,8 @@ describe("vehicle-damage.vue", () => { const partsData = { partsOrQuestions: [ { - location: "Windshield", - name: "Single", + glassLocation: "Windshield", + glassName: "Single", partQuestions: null, parts: [ { @@ -189,8 +189,8 @@ describe("vehicle-damage.vue", () => { ] }, { - name: "Stationary", - location: "Rear", + glassName: "Stationary", + glassLocation: "Rear", parts: [ { partNumber: "DB09626GTYN", @@ -235,7 +235,7 @@ describe("vehicle-damage.vue", () => { selectedWindshieldDamageType: "Replace" }; - const expectedGlassToReplace = [{ location: "Windshield", name: "Single" },]; + const expectedGlassToReplace = [{ glassLocation: "Windshield", glassName: "Single" },]; //Act vehicleDamage.beforeRouteEnter.call( @@ -509,7 +509,7 @@ describe("vehicle-damage.vue", () => { (c) => c(wrapper.vm) ); - store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ location: damageLocation }] }, isRepair: true }; + store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ glassLocation: damageLocation }] }, isRepair: true }; var glassSelections = wrapper.vm.getDamageLocationsFromStore(); @@ -553,7 +553,7 @@ describe("vehicle-damage.vue", () => { eventBusItem: jest.fn(), damage: { - glassToReplace: [{ location: damageLocation, name: damageName }], + glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }], isRepair: isRepair, numberOfChips: 2 }, @@ -583,7 +583,7 @@ describe("vehicle-damage.vue", () => { (c) => c(wrapper.vm) ); - store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ location: damageLocation, name: damageName }] }, isRepair: true }; + store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }] }, isRepair: true }; var glassSelections = wrapper.vm.getDriverSideReplaceOptionsFromStore(); @@ -610,7 +610,7 @@ describe("vehicle-damage.vue", () => { (c) => c(wrapper.vm) ); - store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ location: damageLocation, name: damageName }] }, isRepair: true }; + store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }] }, isRepair: true }; var glassSelections = wrapper.vm.getPassengerSideReplaceOptionsFromStore(); @@ -634,7 +634,7 @@ describe("vehicle-damage.vue", () => { (c) => c(wrapper.vm) ); - store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ location: damageLocation, name: damageName }] }, isRepair: true }; + store.getters = { vehicle: { carId: "C0000000" }, eventBusItem: jest.fn(), damage: { glassToReplace: [{ glassLocation: damageLocation, glassName: damageName }] }, isRepair: true }; var glassSelections = wrapper.vm.getRearReplaceOptionsFromStore(); diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 86435e8e4..9c78bc1b5 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -179,16 +179,16 @@ export default { getDamageLocationsFromStore() { var glassSelections = []; - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD }) || + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD }) || store.getters.damage.isRepair) { glassSelections.push(damageLocationsSelected.WINDSHIELD); } - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.DRIVER || - glass.location === damageLocationsSelected.PASSENGER })) { + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.DRIVER || + glass.glassLocation === damageLocationsSelected.PASSENGER })) { glassSelections.push(damageLocationsSelected.SIDEDOOR); } - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.REAR })) { + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.REAR })) { glassSelections.push(damageLocationsSelected.REARWINDOW); } @@ -205,20 +205,20 @@ export default { windShieldOptions.selectedWindshieldChipCount = store.getters.damage.numberOfChips; } else { - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD && - glass.name === damageLocationsSelected.SINGLE })) { + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && + glass.glassName === damageLocationsSelected.SINGLE })) { windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE; windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.SINGLE); } - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD && - glass.name === damageLocationsSelected.DRIVER })) { + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && + glass.glassName === damageLocationsSelected.DRIVER })) { windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE; windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.DRIVER); } - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.WINDSHIELD && - glass.name === damageLocationsSelected.PASSENGER })) { + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.WINDSHIELD && + glass.glassName === damageLocationsSelected.PASSENGER })) { windShieldOptions.selectedWindshieldDamageType = damageLocationsSelected.REPLACE; windShieldOptions.selectedWindshieldReplaceOptions.push(damageLocationsSelected.PASSENGER); } @@ -229,11 +229,11 @@ export default { getDoorSidesFromStore() { var doorSides = []; - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.DRIVER })){ + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.DRIVER })){ doorSides.push(damageLocationsSelected.DRIVERSIDE); } - if (store.getters.damage.glassToReplace?.some(glass => { return glass.location === damageLocationsSelected.PASSENGER })){ + if (store.getters.damage.glassToReplace?.some(glass => { return glass.glassLocation === damageLocationsSelected.PASSENGER })){ doorSides.push(damageLocationsSelected.PASSENGERSIDE); } @@ -244,8 +244,8 @@ export default { var driverSideReplaceOptions = []; store.getters.damage.glassToReplace?.forEach(glass => { - if (glass.location === damageLocationsSelected.DRIVER){ - driverSideReplaceOptions.push(glass.name); + if (glass.glassLocation === damageLocationsSelected.DRIVER){ + driverSideReplaceOptions.push(glass.glassName); } }); @@ -256,8 +256,8 @@ export default { var passengerSideReplaceOptions = []; store.getters.damage.glassToReplace?.forEach(glass => { - if (glass.location === damageLocationsSelected.PASSENGER){ - passengerSideReplaceOptions.push(glass.name); + if (glass.glassLocation === damageLocationsSelected.PASSENGER){ + passengerSideReplaceOptions.push(glass.glassName); } }); @@ -265,7 +265,7 @@ export default { }, getRearReplaceOptionsFromStore() { - var rearReplaceOptions = store.getters.damage.glassToReplace?.filter(glass => glass.location === damageLocationsSelected.REAR)[0]?.name; + var rearReplaceOptions = store.getters.damage.glassToReplace?.filter(glass => glass.glassLocation === damageLocationsSelected.REAR)[0]?.glassName; return rearReplaceOptions; }, @@ -295,24 +295,24 @@ export default { const selectedGlassToReplace = []; if (this.isWindshieldDamageLocation && !this.isWindshieldRepair){ this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.forEach(wsItem => { - selectedGlassToReplace.push({ location: damageLocationsSelected.WINDSHIELD, name: wsItem}); + selectedGlassToReplace.push({ glassLocation: damageLocationsSelected.WINDSHIELD, glassName: wsItem}); }) } if (this.isDriverSideReplace){ this.sideDoorOptionsData.selectedDriverSideReplaceOptions.forEach(driverItem => { - selectedGlassToReplace.push({ location: damageLocationsSelected.DRIVER, name: driverItem}); + selectedGlassToReplace.push({ glassLocation: damageLocationsSelected.DRIVER, glassName: driverItem}); }) } if (this.isPassengerSideReplace){ this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.forEach(passengerItem => { - selectedGlassToReplace.push({ location: damageLocationsSelected.PASSENGER, name: passengerItem}); + selectedGlassToReplace.push({ glassLocation: damageLocationsSelected.PASSENGER, glassName: passengerItem}); }) } if (this.isRearWindowDamageLocation) { - selectedGlassToReplace.push({ location: damageLocationsSelected.REAR, name: this.selectedRearReplaceOptions}); + selectedGlassToReplace.push({ glassLocation: damageLocationsSelected.REAR, glassName: this.selectedRearReplaceOptions}); } return selectedGlassToReplace; diff --git a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js index c4b2bbd22..6f8c063fb 100644 --- a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js +++ b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.spec.js @@ -13,8 +13,8 @@ const featureListData = { { ColorAnswerText: 'Green Tint', FeatureAnswers: [{ FeatureAnswerText: "heated glass, solar, 1 hole", PartNumber: "DB12209GTYN" }] }, { ColorAnswerText: 'Gray Tint Privacy', FeatureAnswers: [{ FeatureAnswerText: "heated glass, solar, 1 hole", PartNumber: "DB12209YPYN" }] } ], - locationProp: "Rear", - nameProp: "Stationary", + glassLocationProp: "Rear", + glassNameProp: "Stationary", modelValueProp: {} } @@ -36,7 +36,7 @@ describe("glass-part-question.vue", () => { }); - test("Tint mapper, should get tint image by location and tintColor", async () => { + test("Tint mapper, should get tint image by glassLocation and tintColor", async () => { //Arrange @@ -71,7 +71,7 @@ describe("glass-part-question.vue", () => { //Arrange const { wrapper } = setupMocks(featureListData); store.getters.pageData.mockReset(); - store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{name: "Stationary", location: "Rear", parts: [{ partNumber: "DB12209GTYN", color: "Green Tint"}]}] }); + store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{glassName: "Stationary", glassLocation: "Rear", parts: [{ partNumber: "DB12209GTYN", color: "Green Tint"}]}] }); //Act await wrapper.vm.$nextTick(); @@ -110,7 +110,7 @@ describe("glass-part-question.vue", () => { test("default is selected if only one option", async () => { // Arrange store.getters.pageData.mockReset(); - store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{name: "Stationary", location: "Rear", parts: [{ partNumber: "DB12209GTYN", color: "Green Tint"}]}] }); + store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{glassName: "Stationary", glassLocation: "Rear", parts: [{ partNumber: "DB12209GTYN", color: "Green Tint"}]}] }); const { wrapper } = setupMocks(featureListData); // Act @@ -128,7 +128,7 @@ describe("glass-part-question.vue", () => { test("default is not selected if more than one option", async () => { // Arrange store.getters.pageData.mockReset(); - store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{name: "Stationary", location: "Rear", parts: [{ partNumber: "DB12209GTYN", color: "Green Tint"}, { partNumber: "DB12209GTYNXXX", color: "Green Tint"}]}] }); + store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{glassName: "Stationary", glassLocation: "Rear", parts: [{ partNumber: "DB12209GTYN", color: "Green Tint"}, { partNumber: "DB12209GTYNXXX", color: "Green Tint"}]}] }); const { wrapper } = setupMocks(featureListData); // Act @@ -149,13 +149,13 @@ describe("glass-part-question.vue", () => { ["Windshield", "Single", "Blue Tint", []], ["Driver", "Quarter", "Green Tint", []] ]; - test.each(partsForSelectedTintTestCases)("partsForSelectedTint returns correct parts", async (location, name, selectedTint, expectedResults) => { + test.each(partsForSelectedTintTestCases)("partsForSelectedTint returns correct parts", async (glassLocation, glassName, selectedTint, expectedResults) => { // Arrange store.getters.pageData.mockReset(); store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [ { - name: "Stationary", - location: "Rear", + glassName: "Stationary", + glassLocation: "Rear", parts: [ { partNumber: "Glass1", color: "Green Tint"}, { partNumber: "Glass2", color: "Blue Tint"}, @@ -167,14 +167,14 @@ describe("glass-part-question.vue", () => { ] }, { - name: "Single", - location: "Windshield", + glassName: "Single", + glassLocation: "Windshield", parts: [{ partNumber: "Windshield1", color: "Green Tint"}, { partNumber: "Windshield2", color: "Green Tint"}] } ]}); const { wrapper } = setupMocks({ - locationProp: location, - nameProp: name, + glassLocationProp: glassLocation, + glassNameProp: glassName, colorAnswersProp: [], }); @@ -188,9 +188,9 @@ describe("glass-part-question.vue", () => { -function setupMocks({ nameProp, locationProp, colorAnswersProp, modelValueProp }) { +function setupMocks({ glassNameProp, glassLocationProp, colorAnswersProp, modelValueProp }) { //Mock store - store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{name: "Stationary", location: "Rear", parts: []}] }); + store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [{glassName: "Stationary", glassLocation: "Rear", parts: []}] }); store.getters.lineItems = { glassParts: {} } const mountOptions = getMountOptions({ @@ -205,8 +205,8 @@ function setupMocks({ nameProp, locationProp, colorAnswersProp, modelValueProp } }); mountOptions.propsData = { - name: nameProp, - location: locationProp, + glassName: glassNameProp, + glassLocation: glassLocationProp, colorAnswers: colorAnswersProp, modelValue: modelValueProp }; diff --git a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue index 79d9d147d..8ce5cbd5f 100644 --- a/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue +++ b/src/layouts/vehicle-parts/glass-part-question/glass-part-question.vue @@ -12,7 +12,7 @@ :isWide="true" altText="" isRequired - :groupName="`${location}-${name}`" + :groupName="`${glassLocation}-${glassName}`" :validationRules="tintValidationRules">
@@ -25,7 +25,7 @@ textPosition="text-start" :loaderEnabled="false" isRequired - :groupName="`${location}-${name}-${selectedTint}`" + :groupName="`${glassLocation}-${glassName}-${selectedTint}`" :validationRules="partValidationRules" />
@@ -58,8 +58,8 @@ export default { }; }, props: { - name: String, - location: String, + glassName: String, + glassLocation: String, colorAnswers: Array, modelValue: Object, alreadyPopulatedPartsData: { @@ -75,7 +75,7 @@ export default { }, computed: { tintValidationRules() { - const validationRuleName = `${this.location}-${this.name}-tint-required`; + const validationRuleName = `${this.glassLocation}-${this.glassName}-tint-required`; defineRule( validationRuleName, @@ -85,7 +85,7 @@ export default { return validationRuleName; }, partValidationRules() { - const validationRuleName = `${this.location}-${this.name}-part-required`; + const validationRuleName = `${this.glassLocation}-${this.glassName}-part-required`; defineRule( validationRuleName, @@ -96,7 +96,7 @@ export default { colorQuestionText() { return getCustomTransformValue( this.glassColorQuestion, - `${this.location} ${this.name}` + `${this.glassLocation} ${this.glassName}` ); }, @@ -108,7 +108,7 @@ export default { value: tintOption, buttonLabel: tintOption, buttonImage: require(`@/assets/img/tints/${this.getTintSourceImage( - this.location, + this.glassLocation, tintOption )}`), }); @@ -134,9 +134,9 @@ export default { partsForSelectedTint() { const matchingGlass = this.PartDataFromApi.partsOrQuestions?.filter( (dataForGlassLocationAndName) => - dataForGlassLocationAndName.name == this.name && - dataForGlassLocationAndName.location == - this.location + dataForGlassLocationAndName.glassName == this.glassName && + dataForGlassLocationAndName.glassLocation == + this.glassLocation ); const matchingGlassParts = matchingGlass?.length == 1 ? matchingGlass[0].parts : []; @@ -192,8 +192,8 @@ export default { // Gets tint images based on the glass type, and tint name. // Returns an empty string if the src or object is undefined. - getTintSourceImage(location, tintColor) { - const tintSourceObject = getTintImage(location, tintColor); + getTintSourceImage(glassLocation, tintColor) { + const tintSourceObject = getTintImage(glassLocation, tintColor); if ( tintSourceObject === undefined || diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index c736701da..df45f7867 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -41,8 +41,8 @@ store.getters = { const basePartResponse = { partsOrQuestions: [ { - name: "Stationary", - location: "Rear", + glassName: "Stationary", + glassLocation: "Rear", parts: [ { partNumber: "DB12209GTYN", @@ -216,8 +216,8 @@ describe("vehicle-parts.vue", () => { return { partsOrQuestions: [ { - name: "Stationary", - location: "Rear", + glassName: "Stationary", + glassLocation: "Rear", parts: null, partQuestions: [{ testProperty: "some value" @@ -296,8 +296,8 @@ describe("vehicle-parts.vue", () => { store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [ { - name: "Single", - location: "Windshield", + glassName: "Single", + glassLocation: "Windshield", parts: [ { "partNumber": "FW03861GTYN", @@ -374,8 +374,8 @@ describe("vehicle-parts.vue", () => { store.getters.pageData.mockReturnValueOnce({ partsOrQuestions: [ { - name: "Single", - location: "Windshield", + glassName: "Single", + glassLocation: "Windshield", parts: [ { partNumber: "DB12209GTYN", diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index 56c1b9da0..7351f58ab 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -24,10 +24,10 @@
@@ -39,7 +39,7 @@ @ForwardClicked="forwardButtonAction" />
- +