From ab626af82f63037e1e421c5e01567bae87716ab8 Mon Sep 17 00:00:00 2001 From: FrankRua Date: Wed, 2 Mar 2022 10:59:51 -0500 Subject: [PATCH 1/5] Populate already selected options --- .../button-question/button-question.vue | 2 +- .../glass-part-question.vue | 26 ++++++++++++++++--- src/layouts/vehicle-parts/vehicle-parts.vue | 14 ++++++++++ src/store/index.js | 4 +-- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/src/common-components/button-question/button-question.vue b/src/common-components/button-question/button-question.vue index eb199cdf4..f2f87931e 100644 --- a/src/common-components/button-question/button-question.vue +++ b/src/common-components/button-question/button-question.vue @@ -1,7 +1,7 @@ diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index c12aba5b4..0ccfd9c4e 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -17,7 +17,7 @@
- + @@ -75,7 +75,7 @@ export default { // Glass Part Question dynamic component Object.keys(vm.$refs) - .filter((r) => r.includes(vm.refPrefix) && vm.$refs[r][0] !== undefined) + .filter((r) => r.includes(vm.RefPrefix) && vm.$refs[r][0] !== undefined) .forEach((c) => vm.$refs[c][0].initializeComponent({ ColorQuestionWidget: resultMap.cmsContent.ColorQuestionWidget, @@ -95,7 +95,6 @@ export default { data() { return { glassParts: {}, - refPrefix: "partQuestion", alertWidgetData: Object, }; }, @@ -110,7 +109,7 @@ export default { computed: { PartsForQuestions() { const partsData = this.$store.getters.pageData(this.$route.query.fmgPage); - const alreadyPopulatedPartsData = this.$store.getters.lineItems.glassParts; + const alreadyPopulatedPartsData = this.$store.getters.lineItems.glassParts === null ? {} : this.$store.getters.lineItems.glassParts; // Map API result data, to vehicle-parts data structure const mappedData = partsData.partsOrQuestions.map(g => { @@ -148,6 +147,10 @@ export default { PartsFromApi() { return store.getters.pageData(fmgPageValues.VEHICLE_PARTS); + }, + + RefPrefix() { + return 'partQuestion'; } }, diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue index 11653e25d..d7b37b4b0 100644 --- a/src/layouts/vehicle-style/vehicle-style.vue +++ b/src/layouts/vehicle-style/vehicle-style.vue @@ -99,8 +99,8 @@ export default { }, resetDependentState() { // Invokes - store.dispatch(storeActions.RESET_DAMAGE_STATE); - store.dispatch(storeActions.RESET_REGISTRATION_STATE); + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); }, }, diff --git a/src/layouts/vehicle-year/vehicle-year.spec.js b/src/layouts/vehicle-year/vehicle-year.spec.js index c04d61b17..5e6d9bf33 100644 --- a/src/layouts/vehicle-year/vehicle-year.spec.js +++ b/src/layouts/vehicle-year/vehicle-year.spec.js @@ -163,8 +163,8 @@ describe("vehicle-year.vue", () => { expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null) - expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE) - expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE) + expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES) + expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES) }); }); diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index d73ac46f9..460c8ced4 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -95,8 +95,8 @@ export default { store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); // Invokes - store.dispatch(storeActions.RESET_DAMAGE_STATE); - store.dispatch(storeActions.RESET_REGISTRATION_STATE); + store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES); + store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); } }, components: { diff --git a/src/store/index.js b/src/store/index.js index eaa4e4f67..4b0e06eb4 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -122,9 +122,8 @@ export const mutations = { }, resetPartsState(state) { - state.glassParts = null; - state.childParts = null; - state.otherParts = null; + state.order.lineItems.glassParts = null; + state.order.lineItems.otherParts = null; } } diff --git a/src/ux-components/radio/radio.vue b/src/ux-components/radio/radio.vue index cccc0d91d..84267fb01 100644 --- a/src/ux-components/radio/radio.vue +++ b/src/ux-components/radio/radio.vue @@ -42,12 +42,14 @@ export default { }, data() { return { - checkValue: false, + checkValue: Boolean, }; }, created() { if (this.selectedValues) { this.checkValue = this.selectedValues[0] === this.value; + }else{ + this.checkValue = false; } }, methods: { From 21493211034ee28ab904f506940455dbddab7b1d Mon Sep 17 00:00:00 2001 From: bmauger Date: Thu, 3 Mar 2022 10:52:30 -0500 Subject: [PATCH 4/5] Add unit test and fix link issue for Bindu. --- .../vin-information/vin-information.spec.js | 19 ++++++++++++++++++- src/ux-components/text-link/text-link.vue | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/common-components/vin-information/vin-information.spec.js b/src/common-components/vin-information/vin-information.spec.js index 3d0843e10..4938d54fe 100644 --- a/src/common-components/vin-information/vin-information.spec.js +++ b/src/common-components/vin-information/vin-information.spec.js @@ -1 +1,18 @@ -test.todo("some test to be written in the future"); +import { shallowMount } from "@vue/test-utils"; +import vinInformation from "@/common-components/vin-information/vin-information"; + +describe("vinInformation.vue", () => { + it("Should return input class active if isActive is true", async () => { + // Act + const wrapper = shallowMount(vinInformation); + + await wrapper.setData({ + isActive: true, + }); + + // Assert + wrapper.vm.toggleClass() + + expect(wrapper.vm.isActive).toEqual(false); + }); +}); diff --git a/src/ux-components/text-link/text-link.vue b/src/ux-components/text-link/text-link.vue index a03fc52a6..0efcdcc09 100644 --- a/src/ux-components/text-link/text-link.vue +++ b/src/ux-components/text-link/text-link.vue @@ -25,6 +25,7 @@ export default {