From ff6a45e6e420a311444f7b5a03f3b4acc3b34945 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 17:11:52 -0400 Subject: [PATCH 1/7] CSR-835 Update list-button-horizontal, getPartsOrQuestions call --- src/store/index.js | 2 +- .../list-button-horizontal/list-button-horizontal.vue | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 0a57a82a3..dd2a59683 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -717,7 +717,7 @@ export const actions = { endpoint: endpoints.GetPartsOrQuestions.url, payload: { carId: carId, - glass: glassArray, + glass: glassArray ?? [], zip: zipCode, vin: vin }, diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 7011835b9..84d9c715b 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -14,7 +14,6 @@ :name="groupName" :value="value" :aria-required="isRequired" - v-model="checkValue" :checked="checkValue" @change="handleInputChange()" /> @@ -91,7 +90,7 @@ export default { if (Array.isArray(this.selectedValues)) { this.checkValue = this.isMultiSelect ? this.selectedValues.includes(this.value) - : this.selectedValues[0]; + : this.selectedValues[0] == this.value; } }, methods: { From 4c2fbba29eb6fe79803565f9d830ffb9f51fb026 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 19:00:20 -0400 Subject: [PATCH 2/7] CSR-385 Fix list-button-horizontal --- .../list-button-horizontal/list-button-horizontal.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 84d9c715b..94bd59534 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -12,8 +12,8 @@ :type="isMultiSelect ? 'checkbox' : 'radio'" :id="buttonID" :name="groupName" - :value="value" :aria-required="isRequired" + v-model="checkValue" :checked="checkValue" @change="handleInputChange()" /> From d8fa80bbe1de272768692a5329c1c90198d5c0f1 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 13 Sep 2022 19:08:26 -0400 Subject: [PATCH 3/7] CSR-835 Fix broken test --- .../list-button-horizontal/list-button-horizontal.spec.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js index 5c288f660..08aaad712 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.spec.js @@ -211,11 +211,12 @@ describe("list-button-horizontal.vue", () => { isWide: false, modelValue: ["List Card Checkbox"], isMultiSelect: false, + value: "Car-Front", selectedValues: ["Car-Front"] }, }); // Assert - expect(wrapper.componentVM.checkValue).toEqual("Car-Front"); + expect(wrapper.vm.checkValue).toEqual(true); }); it("Should run handleCheckChange if selectingInitiatesLoad is false and handleInputChange is triggered", async () => { From 9d6b829cb174f08d6c8c62ad147404c2001a8d7e Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Wed, 14 Sep 2022 08:04:21 -0400 Subject: [PATCH 4/7] trying to fix repair-chips --- src/common-components/button-question/button-question.vue | 7 ++++++- .../windshield-chip-count-question.vue | 3 ++- src/store/index.js | 8 +++++++- .../list-button-horizontal/list-button-horizontal.vue | 2 +- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index 6a235ef8a..2f7d3e0a1 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -173,11 +173,16 @@ export default { if(this.selectingInitiatesLoad) { this.selectedValues = val.value; } else { - if(Array.isArray(this.selectedValues)) { + if(this.isMultiSelect) { const newSelectedValues = this.selectedValues; val.checkValue ? newSelectedValues.push(val.value) : newSelectedValues.splice(newSelectedValues.indexOf(val.value), 1); this.selectedValues = newSelectedValues; } + else if (Array.isArray(this.selectedValues)) { + this.selectedValues[0] = val.value; + const temp = this.selectedValues; + this.selectedValues = temp; + } else { this.selectedValues = val.value; } diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue index 25d273eca..31a681857 100644 --- a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue +++ b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue @@ -47,7 +47,8 @@ export default ({ return this.modelValue; }, set: function(newValue) { - this.$emit("update:modelValue", newValue); + const numberValue = Number(newValue); + this.$emit("update:modelValue", numberValue); } }, }, diff --git a/src/store/index.js b/src/store/index.js index dd2a59683..95dd63ef7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -942,8 +942,14 @@ export const actions = { .slice() .sort() .every((obj, index) => obj.glassLocation === selectedGlassPassedInSorted[index].glassLocation && obj.glassName === selectedGlassPassedInSorted[index].glassName); + const isWindshieldRepairTheSame = isWindshieldRepair === context.state.order.damage.isRepair; + const isChipCountTheSame = Array.isArray(selectedWindshieldChipCount) //TODO: fix the underlying components so this is never an array + ? selectedWindshieldChipCount[0] === context.state.order.damage.numberOfChips + : selectedWindshieldChipCount === context.state.order.damage.numberOfChips; - if (!isGlassToReplaceTheSame) { + const isDamageChanging = !isGlassToReplaceTheSame || !isWindshieldRepairTheSame || (isWindshieldRepair && !isChipCountTheSame); + + if (isDamageChanging) { //Reset dependent state when changing context.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES); diff --git a/src/ux-components/list-button-horizontal/list-button-horizontal.vue b/src/ux-components/list-button-horizontal/list-button-horizontal.vue index 94bd59534..c037cb3b7 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -122,7 +122,7 @@ export default { handleCheckChange() { const emitEvent = { checkValue: this.checkValue, // only read on checkboxes, on handleCheckedChanged on button-question - value: this.value.toString(), + value: this.value, buttonId: this.buttonID && this.buttonID.toString(), }; From a50c2220ed04a47e8ec3753749b48873998d6435 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Sep 2022 08:30:34 -0400 Subject: [PATCH 5/7] CSR-779 remove promise settle from mixin --- src/layouts/estimate/estimate.vue | 5 ++--- src/layouts/vin-lookup/vin-lookup.vue | 13 ++++++++----- src/mixins/base-mixin.js | 19 +++++-------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index e003348bd..f38d6b77d 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -181,13 +181,13 @@ export default { state: zipCodeData.state, }, false); - if (!zipCodeData.isZipValid) { + if (!zipCodeData.isValid) { this.displayInvalidZipAlert = true; return this.$refs.funnelFooter.removeLoader(); } this.displayInvalidZipAlert = false; - if (!zipCodeData.isZipServiceable) { + if (!zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; return this.$refs.funnelFooter.removeLoader(); } @@ -220,7 +220,6 @@ export default { }, computed: { AlertNonServiceableZipHeader(){ - console.log(this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText")); return this.getCmsContent("AlertNonServiceableZipWidget", "HeadlineText").replaceAll("{custom:serviceZip}", this.serviceZipCode); }, AlertNonServiceableZipBody(){ diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index ff0e97f66..0118d8d67 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -238,13 +238,16 @@ export default { resultKey: "vehicleLookupResponse", promise: vehicleLookupResponse, }, + { + resultKey: "zipCodeData", + promise: this.getZipCodeData(this.serviceZipCode) + } ]; const resultMap = await settleAllPromises(promiseResultMap); - const zipCodeData = await this.getZipCodeData(this.serviceZipCode); // If a Service Zip is entered and it is an invalid zip code (ex. 11111) then show an alert - const isZipValid = zipCodeData.isValid; + const isZipValid = resultMap.zipCodeData.isValid; if (this.serviceZipCode && !isZipValid) { this.displayInvalidZipAlert = true; return this.$refs.funnelFooter.removeLoader(); @@ -252,14 +255,14 @@ export default { this.displayInvalidZipAlert = false; // If either lookup fails, remove the loader and stop processing the page. - if (!resultMap.vehicleLookupResponse || !zipCodeData.isServiceable) { + if (!resultMap.vehicleLookupResponse || !resultMap.zipCodeData.isServiceable) { // If the vehicle result is undefined, the vin entered was invalid. if(!resultMap.vehicleLookupResponse) { this.displayVinNotFoundAlert = true; } // Check if Service Zip entered is serviceable, if not display an alert - if (!zipCodeData.isServiceable) { + if (!resultMap.zipCodeData.isServiceable) { this.displayNonServiceableZipAlert = true; } @@ -293,7 +296,7 @@ export default { await this.dispatchStoreAction(storeActions.SAVE_EMAIL, this.emailAddress, false); await this.dispatchStoreAction(storeActions.SAVE_SERVICE_LOCATION, { zipCode: this.serviceZipCode, - state: zipCodeData.state, + state: resultMap.zipCodeData.state, }, false); return await this.navigateForward(); diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index b19b458da..f175c61b8 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -49,21 +49,12 @@ export default { return footerInfoBox ? footerInfoBox.offsetHeight : 0; }, async getZipCodeData(zipCode) { - const serviceZipValidationResponse = this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode }); - - const promiseResultMap = [ - { - resultKey: "serviceZipValidationResponse", - promise: serviceZipValidationResponse, - } - ]; - - const resultMap = await settleAllPromises(promiseResultMap); - + const serviceZipValidationResponse = await this.dispatchStoreAction(storeActions.VALIDATE_ZIP, { zip: zipCode }); + return { - isZipValid: resultMap.serviceZipValidationResponse.isValid, - isZipServiceable: resultMap.serviceZipValidationResponse.isServiceable, - state: resultMap.serviceZipValidationResponse.state + isValid: serviceZipValidationResponse.data.isValid, + isServiceable: serviceZipValidationResponse.data.isServiceable, + state: serviceZipValidationResponse.data.state }; } }, From cafb8d898d01578080930dadfcb80bb46ee33845 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Sep 2022 11:40:40 -0400 Subject: [PATCH 6/7] add zipcode data to api responses to fix tests --- src/layouts/vin-lookup/vin-lookup.spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index d0d20a531..4f917c47e 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -226,6 +226,9 @@ function mockOutPromises(carId = 'C00000') { const apiResponses = { vehicleLookupResponse: { carId: carId + }, + zipCodeData: { + isValid: true, isServiceable: true, state: "OH" } }; From e7bc1f7ecc5f44af232ae3f8c432b24da3104a5a Mon Sep 17 00:00:00 2001 From: CarlNation Date: Thu, 15 Sep 2022 13:37:34 -0400 Subject: [PATCH 7/7] CSR-779 - match mock data to promise data --- src/mixins/base-mixin.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/base-mixin.spec.js b/src/mixins/base-mixin.spec.js index 9c7ebcd90..6009dd67c 100644 --- a/src/mixins/base-mixin.spec.js +++ b/src/mixins/base-mixin.spec.js @@ -99,7 +99,7 @@ describe("baseMixin.js", () => { test("getZipCodeData calls dispatch", () => { const mixIn = getMixInInstance({}); mixIn.methods.dispatchStoreAction = jest.fn(); - mixIn.methods.dispatchStoreAction.mockReturnValue({ isValid:true, isServiceable:true, state:"OH" }); + mixIn.methods.dispatchStoreAction.mockReturnValue({data: { isValid:true, isServiceable:true, state:"OH" }}); const type = ""; const payload = { zip: 43015 };