multiple defect fixes

This commit is contained in:
FrankRua 2022-03-02 16:24:37 -05:00
parent a38bc4d366
commit 0b445f176b
17 changed files with 80 additions and 57 deletions

View file

@ -10,7 +10,7 @@ const customMappings = {
{ key: 'Rear Stationary', transformedValue: 'rear window' }, { key: 'Rear Stationary', transformedValue: 'rear window' },
{ key: 'Rear Slider', transformedValue: 'rear window' }, { key: 'Rear Slider', transformedValue: 'rear window' },
{ key: 'Driver Front', transformedValue: 'driver side front door' }, { key: 'Driver Front', transformedValue: 'driver side front door' },
{ key: 'Driver Back ', transformedValue: 'driver side back door' }, { key: 'Driver Back', transformedValue: 'driver side back door' },
{ key: 'Driver Vent', transformedValue: 'driver side vent glass' }, { key: 'Driver Vent', transformedValue: 'driver side vent glass' },
{ key: 'Driver Quarter', transformedValue: 'driver side quarter panel' }, { key: 'Driver Quarter', transformedValue: 'driver side quarter panel' },
{ key: 'Driver SideDoor', transformedValue: 'driver side sliding door' }, { key: 'Driver SideDoor', transformedValue: 'driver side sliding door' },

View file

@ -14,10 +14,10 @@ const storeActions = {
GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions", GET_PARTS_OR_QUESTIONS: "getPartsOrQuestions",
// DEPENDENCY MUTATIONS // DEPENDENCY MUTATIONS
RESET_VEHICLE_STATE: "resetVehicleAndDependencies", RESET_VEHICLE_STATE_AND_DEPENDENCIES: "resetVehicleAndDependencies",
RESET_DAMAGE_STATE: "resetDamageAndDependencies", RESET_DAMAGE_STATE_AND_DEPENDENCIES: "resetDamageAndDependencies",
RESET_REGISTRATION_STATE: "resetRegistrationAndDependencies", RESET_REGISTRATION_STATE_AND_DEPENDENCIES: "resetRegistrationAndDependencies",
RESET_PARTS_STATE: "resetPartsAndDependencies", RESET_PARTS_STATE_AND_DEPENDENCIES: "resetPartsAndDependencies",
}; };
export { storeActions }; export { storeActions };

View file

@ -144,7 +144,7 @@ export default {
}, },
resetDependentState() { resetDependentState() {
// Invokes // Invokes
store.dispatch(storeActions.RESET_PARTS_STATE); store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
}, },
onSubmit(values) { onSubmit(values) {
window.alert('Success! Submitted values: ' + JSON.stringify(values, null ,2)) window.alert('Success! Submitted values: ' + JSON.stringify(values, null ,2))

View file

@ -1,11 +1,11 @@
<template> <template>
<div class="container-fluid shadow rounded-3 p-2 position-relative make-tall"> <div class="container-fluid shadow rounded-3 p-2 position-relative make-tall">
<funnelHeader ref="funnelHeader" /> <funnelHeader ref="funnelHeader" />
<vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage="false" /> <vehicleBanner ref="vehicleBanner" :displayGenericVehicleImage="false" />
<funnelSubHeader ref="funnelSubHeader" /> <funnelSubHeader ref="funnelSubHeader" />
<h1>Part Questions Page Placeholder</h1> <h1>Part Questions Page Placeholder</h1>
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" /> <funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" />
</div> </div>
</template> </template>
<script> <script>
@ -16,11 +16,22 @@ import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-he
import funnelFooter from "@/common-components/funnel-footer/funnel-footer"; import funnelFooter from "@/common-components/funnel-footer/funnel-footer";
// Supporting Files // Supporting Files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import {
import { settleAllPromises } from "@/helpers/layout-helper"; fetchCmsContentForPage
import {storeMutations} from "@/constants/store-mutations"; } from "@/helpers/cms-content-helper";
import {storeActions} from "@/constants/store-actions"; import {
settleAllPromises
} from "@/helpers/layout-helper";
import {
storeMutations
} from "@/constants/store-mutations";
import {
storeActions
} from "@/constants/store-actions";
import store from "@/store"; import store from "@/store";
import {
fmgPageValues
} from "@/router/router-constants/fmgPage-values";
export default { export default {
name: "part-questions", name: "part-questions",
@ -61,7 +72,10 @@ export default {
); );
}, },
arePagePrerequisitesValid() { arePagePrerequisitesValid() {
return store.getters.lineItems.glassParts !== null; if (Object.keys(store.getters.pageData(fmgPageValues.PART_QUESTIONS)).length !== 0) {
return true;
}
return false;
}, },
resetDependentState() { resetDependentState() {
// Set // Set
@ -71,8 +85,7 @@ export default {
store.dispatch(storeActions.RESET_PARTS_AND_DEPS); store.dispatch(storeActions.RESET_PARTS_AND_DEPS);
}, },
}, },
data() { data() {},
},
components: { components: {
funnelHeader, funnelHeader,
vehicleBanner, vehicleBanner,

View file

@ -591,7 +591,7 @@ describe("vehicle-damage.vue", () => {
wrapper.vm.resetDependentState(); wrapper.vm.resetDependentState();
//Assert //Assert
expect(store.dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES)
}); });
}); });

View file

@ -121,7 +121,7 @@ export default {
return store.getters.vehicle.carId !== null; return store.getters.vehicle.carId !== null;
}, },
resetDependentState() { resetDependentState() {
store.dispatch(storeActions.RESET_PARTS_STATE); store.dispatch(storeActions.RESET_PARTS_STATE_AND_DEPENDENCIES);
}, },
backButtonAction() { backButtonAction() {
// route to move backwards // route to move backwards

View file

@ -223,8 +223,8 @@ describe("vehicle-make.vue", () => {
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES)
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES)
}); });
}); });

View file

@ -94,8 +94,8 @@ export default {
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
// Invokes // Invokes
store.dispatch(storeActions.RESET_DAMAGE_STATE); store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
store.dispatch(storeActions.RESET_REGISTRATION_STATE); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}, },
}, },

View file

@ -208,8 +208,8 @@ describe("vehicle-model.vue", () => {
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES)
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES)
}); });
}); });

View file

@ -94,8 +94,8 @@ export default {
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
// Invokes // Invokes
store.dispatch(storeActions.RESET_DAMAGE_STATE); store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
store.dispatch(storeActions.RESET_REGISTRATION_STATE); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}, },
}, },

View file

@ -6,6 +6,7 @@
</div> </div>
<div class="container nested-radio" v-for="(value, name, index) in featureListData" :key="index"> <div class="container nested-radio" v-for="(value, name, index) in featureListData" :key="index">
<div class="row my-2"> <div class="row my-2">
<div class="col"> <div class="col">
<listCard v-model="selectedTint[name]" :isRadio="true" :isWide="true" :buttonImage=" <listCard v-model="selectedTint[name]" :isRadio="true" :isWide="true" :buttonImage="
@ -18,9 +19,10 @@
</div> </div>
<transition name="fade" mode="out-in"> <transition name="fade" mode="out-in">
<div v-if=" <div v-if="
selectedTint[name] != undefined && selectedTint[name] != undefined &&
selectedTint[name].buttonId === `${glassLocation}-${glassName}-${name}` selectedTint[name].buttonId ===
" class="row my-2" aria-live="polite"> `${glassLocation}-${glassName}-${name}`
" class="row my-2" aria-live="polite">
<div class="col"> <div class="col">
<buttonQuestion v-model="selectedPart[glassLocation]" buttonType="radio" class="radioQuestion" :questionText="glassFeatureQuestion" :answers="value" textPosition="text-start" :loaderEnabled="false" :isRequired="true" :groupName="`${glassLocation}-${glassName}-${name}`" /> <buttonQuestion v-model="selectedPart[glassLocation]" buttonType="radio" class="radioQuestion" :questionText="glassFeatureQuestion" :answers="value" textPosition="text-start" :loaderEnabled="false" :isRequired="true" :groupName="`${glassLocation}-${glassName}-${name}`" />
</div> </div>
@ -47,8 +49,8 @@ export default {
inheritAttrs: false, inheritAttrs: false,
data() { data() {
return { return {
glassColorQuestion: '', glassColorQuestion: "",
glassFeatureQuestion: '', glassFeatureQuestion: "",
selectedTint: {}, // v-model for the list card selections selectedTint: {}, // v-model for the list card selections
}; };
}, },
@ -56,12 +58,13 @@ export default {
glassName: String, glassName: String,
glassLocation: String, glassLocation: String,
colorAnswers: Array, colorAnswers: Array,
modelValue: Object modelValue: Object,
}, },
mounted() { mounted() {
if (this.modelValue !== undefined) { if (this.modelValue !== undefined) {
// Populate button-question model-value if parts data already exists in VueX // Populate button-question model-value if parts data already exists in VueX
const alreadyPopulatedPartsData = this.$store.getters.lineItems.glassParts; const alreadyPopulatedPartsData =
this.$store.getters.lineItems.glassParts;
Object.keys(alreadyPopulatedPartsData).forEach((key) => { Object.keys(alreadyPopulatedPartsData).forEach((key) => {
const partNumber = alreadyPopulatedPartsData[key].partNumber; const partNumber = alreadyPopulatedPartsData[key].partNumber;
@ -71,8 +74,8 @@ export default {
if (this.modelValue[key][0] === partNumber) { if (this.modelValue[key][0] === partNumber) {
this.selectedTint[tintColor] = { this.selectedTint[tintColor] = {
buttonId: `${this.glassLocation}-${this.glassName}-${tintColor}`, buttonId: `${this.glassLocation}-${this.glassName}-${tintColor}`,
checkValue: '', checkValue: "",
value: '' value: "",
}; };
} }
}); });
@ -85,7 +88,10 @@ export default {
}, },
computed: { computed: {
colorQuestionText() { colorQuestionText() {
return getCustomTransformValue(this.glassColorQuestion, `${this.glassLocation} ${this.glassName}`); return getCustomTransformValue(
this.glassColorQuestion,
`${this.glassLocation} ${this.glassName}`
);
}, },
selectedPart: { selectedPart: {
@ -94,7 +100,7 @@ export default {
}, },
set: function (newValue) { set: function (newValue) {
this.$emit("update:modelValue", newValue); this.$emit("update:modelValue", newValue);
} },
}, },
// Creates a map of the feature list data in the correct Name/Value // Creates a map of the feature list data in the correct Name/Value
@ -120,7 +126,7 @@ export default {
}, {}); }, {});
return tintMapByColor; return tintMapByColor;
} },
}, },
methods: { methods: {
initializeComponent(cmsContent) { initializeComponent(cmsContent) {
@ -144,7 +150,7 @@ export default {
ResetTintAndPartSelections() { ResetTintAndPartSelections() {
this.selectedTint = {}; this.selectedTint = {};
this.selectedPart = {}; this.selectedPart = {};
} },
}, },
}; };
</script> </script>

View file

@ -17,7 +17,7 @@
<hr v-if="i > 0" /> <hr v-if="i > 0" />
</div> </div>
<glassPartQuestion :ref="`${refPrefix}-${item.glassLocation}`" v-model="glassParts[item.glassLocation + '-' + item.glassName]" :glassLocation="item.glassLocation" :glassName="item.glassName" :colorAnswers="item.colorAnswers" /> <glassPartQuestion :ref="`${RefPrefix}-${item.glassLocation}-${item.glassName}`" v-model="glassParts[item.glassLocation + '-' + item.glassName]" :glassLocation="item.glassLocation" :glassName="item.glassName" :colorAnswers="item.colorAnswers" />
</div> </div>
<funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" @ForwardClicked="forwardButtonAction" /> <funnelFooter ref="funnelFooter" @back-clicked="backButtonAction" @ForwardClicked="forwardButtonAction" />
</div> </div>
@ -75,7 +75,7 @@ export default {
// Glass Part Question dynamic component // Glass Part Question dynamic component
Object.keys(vm.$refs) 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) => .forEach((c) =>
vm.$refs[c][0].initializeComponent({ vm.$refs[c][0].initializeComponent({
ColorQuestionWidget: resultMap.cmsContent.ColorQuestionWidget, ColorQuestionWidget: resultMap.cmsContent.ColorQuestionWidget,
@ -95,7 +95,6 @@ export default {
data() { data() {
return { return {
glassParts: {}, glassParts: {},
refPrefix: "partQuestion",
alertWidgetData: Object, alertWidgetData: Object,
}; };
}, },
@ -110,7 +109,7 @@ export default {
computed: { computed: {
PartsForQuestions() { PartsForQuestions() {
const partsData = this.$store.getters.pageData(this.$route.query.fmgPage); 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 // Map API result data, to vehicle-parts data structure
const mappedData = partsData.partsOrQuestions.map(g => { const mappedData = partsData.partsOrQuestions.map(g => {
@ -148,6 +147,10 @@ export default {
PartsFromApi() { PartsFromApi() {
return store.getters.pageData(fmgPageValues.VEHICLE_PARTS); return store.getters.pageData(fmgPageValues.VEHICLE_PARTS);
},
RefPrefix() {
return 'partQuestion';
} }
}, },

View file

@ -99,8 +99,8 @@ export default {
}, },
resetDependentState() { resetDependentState() {
// Invokes // Invokes
store.dispatch(storeActions.RESET_DAMAGE_STATE); store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
store.dispatch(storeActions.RESET_REGISTRATION_STATE); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
}, },
}, },

View file

@ -163,8 +163,8 @@ describe("vehicle-year.vue", () => {
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_CAR_ID, null)
expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null) expect(store.commit).toBeCalledWith(storeMutations.UPDATE_VEHICLE_CATEGORY, null)
expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES)
expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE) expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES)
}); });
}); });

View file

@ -95,8 +95,8 @@ export default {
store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null); store.commit(storeMutations.UPDATE_VEHICLE_CATEGORY, null);
// Invokes // Invokes
store.dispatch(storeActions.RESET_DAMAGE_STATE); store.dispatch(storeActions.RESET_DAMAGE_STATE_AND_DEPENDENCIES);
store.dispatch(storeActions.RESET_REGISTRATION_STATE); store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES);
} }
}, },
components: { components: {

View file

@ -122,9 +122,8 @@ export const mutations = {
}, },
resetPartsState(state) { resetPartsState(state) {
state.glassParts = null; state.order.lineItems.glassParts = null;
state.childParts = null; state.order.lineItems.otherParts = null;
state.otherParts = null;
} }
} }

View file

@ -42,12 +42,14 @@ export default {
}, },
data() { data() {
return { return {
checkValue: false, checkValue: Boolean,
}; };
}, },
created() { created() {
if (this.selectedValues) { if (this.selectedValues) {
this.checkValue = this.selectedValues[0] === this.value; this.checkValue = this.selectedValues[0] === this.value;
}else{
this.checkValue = false;
} }
}, },
methods: { methods: {