Merge remote-tracking branch 'origin/develop' into feature/CSR-550

This commit is contained in:
Scott Kiener 2022-05-19 14:33:12 -04:00
commit 0119d1a06a
12 changed files with 70 additions and 82 deletions

View file

@ -34,7 +34,7 @@ module.exports = {
testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"], testMatch: ["**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)"],
coverageThreshold: { coverageThreshold: {
global: { global: {
statements: 85, statements: 84,
// Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90 // Got the go ahead from Mark to temporarily lower this. Taking out initialize component made the year,make,model and style coverage drop a bit. Once unit tests for license plate lookup, vin lookup and address lookup are in the coverage should go back up to 90
}, },
}, },

View file

@ -40,7 +40,7 @@
</div> </div>
</fieldset> </fieldset>
</div> </div>
<div class="row form-test-error"> <div class="row form-test-error mt-1">
<error-message :name="groupName" v-if="!suppressError"></error-message> <error-message :name="groupName" v-if="!suppressError"></error-message>
</div> </div>
</div> </div>
@ -134,7 +134,7 @@ export default {
return answer.Name ? answer.Name : answer; return answer.Name ? answer.Name : answer;
}, },
handleCheckedChanged(val) { handleCheckedChanged(val) {
this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, val.value, true); this.pushEventToGA(this.$route.query[queryStrings.FMG_PAGE], this.GaActions.CLICKED, val.value, true);
if(this.isMultiSelect && this.selectedValues) { if(this.isMultiSelect && this.selectedValues) {

File diff suppressed because one or more lines are too long

View file

@ -19,6 +19,7 @@
:validationRules="validationRules" :validationRules="validationRules"
@change="handleChange" @change="handleChange"
@blur="handleChange" @blur="handleChange"
:maxlength="maxLength ? maxLength : '999'"
/> />
<div v-show="errorMessage" class="row my-2 form-test-error"> <div v-show="errorMessage" class="row my-2 form-test-error">
<span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span> <span class="d-inline-flex mt-0" role="alert">{{ errorMessage }}</span>
@ -55,6 +56,7 @@ export default {
validationRules: String, validationRules: String,
semiAggressiveValidation: Boolean, semiAggressiveValidation: Boolean,
cmsWidgetName: String, cmsWidgetName: String,
maxLength: String,
}, },
setup(props) { setup(props) {
const propsClone = Object.assign({}, props); const propsClone = Object.assign({}, props);

View file

@ -26,6 +26,7 @@ const GaLabels = {
ERROR: 'Error', ERROR: 'Error',
LICENSE_PLATE_LOOKUP: 'License_Plate_Look_Up', LICENSE_PLATE_LOOKUP: 'License_Plate_Look_Up',
VIN_LOOKUP: 'Vin_Look_Up', VIN_LOOKUP: 'Vin_Look_Up',
ADDRESS_LOOKUP: 'Address_Look_up',
}; };

View file

@ -150,6 +150,16 @@ export default {
this.$route this.$route
); );
}, },
attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => {
this.pushEventToGA(
this.$route.query[this.queryStrings.FMG_PAGE],
this.GaActions.SUBMITTED,
this.GaLabels.ADDRESS_LOOKUP,
true
);
});
},
getRegistrationAddressFromStore() { getRegistrationAddressFromStore() {
return store.getters.vehicle.registration.address; return store.getters.vehicle.registration.address;
}, },
@ -356,6 +366,9 @@ export default {
} }
} }
}, },
mounted() {
this.attachCustomEvents();
},
computed: { computed: {
AlertNonServiceableZipHeader(){ AlertNonServiceableZipHeader(){
const zipCode = this.serviceZipCode ? this.serviceZipCode : this.customerQuestions.addressQuestions.zipCode; const zipCode = this.serviceZipCode ? this.serviceZipCode : this.customerQuestions.addressQuestions.zipCode;

View file

@ -87,7 +87,6 @@ describe("license-plate-lookup.vue", () => {
//Assert //Assert
expect(wrapper.vm.$router.navigate).toHaveBeenCalled(); expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
}); });
}); });

View file

@ -24,7 +24,7 @@
v-model="registrationZip" v-model="registrationZip"
inputId="zip" inputId="zip"
mask="#####" mask="#####"
validationRules="zip-required" validationRules="zip-required|zip-format"
/> />
</div> </div>
</div> </div>
@ -54,6 +54,7 @@
v-model="serviceZip" v-model="serviceZip"
inputId="serviceZip" inputId="serviceZip"
validationRules="zip-required|zip-format" validationRules="zip-required|zip-format"
semiAggressiveValidation
/> />
</div> </div>
</div> </div>
@ -87,56 +88,25 @@ import alert from "@/ux-components/alert/alert";
import textboxQuestion from "@/common-components/textbox-question/textbox-question"; import textboxQuestion from "@/common-components/textbox-question/textbox-question";
import loadingModal from '@/common-components/loading-modal/loading-modal.vue'; import loadingModal from '@/common-components/loading-modal/loading-modal.vue';
// Supporting files // Supporting files
import { import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
fetchCmsContentForPage import { settleAllPromises } from "@/helpers/layout-helper";
} from "@/helpers/cms-content-helper";
import {
settleAllPromises
} from "@/helpers/layout-helper";
import store from "@/store"; import store from "@/store";
import baseMixin from "@/mixins/base-mixin.js"; import baseMixin from "@/mixins/base-mixin.js";
import { import { storeActions } from "@/constants/store-actions";
storeActions import { storeMutations } from "@/constants/store-mutations";
} from "@/constants/store-actions"; import { errorMessages } from "@/constants/error-messages";
import { import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
storeMutations import { getDamageString, isGlassAvailableForCarId, } from "@/helpers/damage-helper";
} from "@/constants/store-mutations"; import { required, regex, } from "@/helpers/validation-rules";
import { import { Form, defineRule, } from "vee-validate";
errorMessages
} from "@/constants/error-messages";
import {
navigateAfterSaveToHeritageFunnel
} from "@/helpers/heritage-integration/navigation-helper";
import {
getDamageString,
isGlassAvailableForCarId,
} from "@/helpers/damage-helper";
import {
required,
regex,
} from "@/helpers/validation-rules";
import {
Form,
defineRule,
} from "vee-validate";
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES
defineRule( defineRule("license-plate-required", required(errorMessages.LICENSE_PLATE_REQUIRED));
"license-plate-required",
required(errorMessages.LICENSE_PLATE_REQUIRED)
);
defineRule("zip-required", required(errorMessages.REGISTRATION_ZIP_REQUIRED)); defineRule("zip-required", required(errorMessages.REGISTRATION_ZIP_REQUIRED));
defineRule( defineRule("zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT));
"email-address-required", defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED));
required(errorMessages.EMAIL_ADDRESS_REQUIRED) defineRule("email-address-format", regex(/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/, errorMessages.EMAIL_ADDRESS_FORMAT));
);
defineRule(
"email-address-format",
regex(
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/,
errorMessages.EMAIL_ADDRESS_FORMAT
)
);
export default { export default {
name: "license-plate-lookup", name: "license-plate-lookup",
async beforeRouteEnter(to, from, next) { async beforeRouteEnter(to, from, next) {
@ -229,12 +199,12 @@ export default {
}, },
attachCustomEvents() { attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => { this.prependActionToMethod(this, this.forwardButtonAction, () => {
this.pushEventToGA( this.pushEventToGA(
this.$route.query[this.queryStrings.FMG_PAGE], this.$route.query[this.queryStrings.FMG_PAGE],
this.GaActions.SUBMITTED, this.GaActions.SUBMITTED,
this.GaLabels.LICENSE_PLATE_LOOKUP, this.GaLabels.LICENSE_PLATE_LOOKUP,
true true
); );
}); });
}, },
getLicensePlateFromStore() { getLicensePlateFromStore() {

View file

@ -24,6 +24,7 @@
disableAutoFill disableAutoFill
validationRules="vin-required|vin-format" validationRules="vin-required|vin-format"
:isDisabled="isVinFieldReadOnly" :isDisabled="isVinFieldReadOnly"
maxLength="17"
/> />
</div> </div>
</div> </div>
@ -41,7 +42,7 @@
mask="#####" mask="#####"
isRequired isRequired
disableAutoFill disableAutoFill
validationRules="zip-required" validationRules="zip-required|zip-format"
/> />
</div> </div>
</div> </div>
@ -141,29 +142,12 @@ import { Form, defineRule } from "vee-validate";
import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper"; import { navigateAfterSaveToHeritageFunnel } from "@/helpers/heritage-integration/navigation-helper";
// DEFINE VALIDATION RULES // DEFINE VALIDATION RULES
defineRule( defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED));
"zip-required", defineRule("zip-format", regex(/(^\d{5}$)|(^\d{5}-\d{4}$)/, errorMessages.SERVICE_ZIP_FORMAT));
required(errorMessages.SERVICE_ZIP_REQUIRED) defineRule("email-address-required", required(errorMessages.EMAIL_ADDRESS_REQUIRED));
); defineRule("email-address-format", regex(/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/, errorMessages.EMAIL_ADDRESS_FORMAT));
defineRule( defineRule("vin-required", required(errorMessages.VIN_REQUIRED));
"email-address-required", defineRule("vin-format", regex(/^[A-HJ-NPR-Z0-9]{17}$/, errorMessages.VIN_FORMAT));
required(errorMessages.EMAIL_ADDRESS_REQUIRED)
);
defineRule(
"email-address-format",
regex(
/^([a-zA-Z0-9_\-.+]+)@([a-zA-Z0-9_\-.]+)\.([a-zA-Z]{2,})$/,
errorMessages.EMAIL_ADDRESS_FORMAT
)
);
defineRule(
"vin-required",
required(errorMessages.VIN_REQUIRED)
);
defineRule(
"vin-format",
regex(/^[A-HJ-NPR-Z0-9]{17}$/, errorMessages.VIN_FORMAT)
);
export default { export default {
name: "vin-lookup", name: "vin-lookup",
@ -200,6 +184,9 @@ export default {
vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0, vinPopulatedOnPageLoad: this.getVinFromStore()?.length > 0,
}; };
}, },
mounted() {
this.attachCustomEvents();
},
watch: { watch: {
vin() { vin() {
this.$refs.funnelFooter.updateButtonText( this.$refs.funnelFooter.updateButtonText(
@ -272,12 +259,12 @@ export default {
getZipFromStore(){ getZipFromStore(){
return store.getters.order.serviceLocation.zipCode; return store.getters.order.serviceLocation.zipCode;
}, },
attachCustomEvents() { attachCustomEvents() {
this.prependActionToMethod(this, this.forwardButtonAction, () => { this.prependActionToMethod(this, this.forwardButtonAction, () => {
this.pushEventToGA( this.pushEventToGA(
this.$route.query[this.queryStrings.FMG_PAGE], this.$route.query[this.queryStrings.FMG_PAGE],
this.GaActions.SUBMITTED, this.GaActions.SUBMITTED,
this.GaLabels.VINLOOKUP, this.GaLabels.VIN_LOOKUP,
true true
); );
}); });

View file

@ -97,8 +97,9 @@ export default {
}, },
prependActionToMethod(object, method, actionToPrepend) { prependActionToMethod(object, method, actionToPrepend) {
const baseMethod = object[method.name]; const baseMethodName = method.name.startsWith('bound ') ? method.name.substring(6) : method.name ;
object[method.name] = function () { const baseMethod = object[baseMethodName];
object[baseMethodName] = function () {
actionToPrepend.apply(this, arguments); actionToPrepend.apply(this, arguments);
return baseMethod.apply(object, arguments); return baseMethod.apply(object, arguments);
}; };

View file

@ -107,4 +107,17 @@ describe("analyticsMixin.js", () => {
}]); }]);
}); });
test("Obj is not null after action prepended", () => {
//Arrange
const obj = {baseMethodName:"testMethodName", data:"testData"};
const method = {name:"testMethodName", data:"testData" }
const action = "testAction";
//Act
analyticsMixin.methods.prependActionToMethod(obj, method, action);
//Assert
expect(obj!=null);
});
}); });

View file

@ -88,12 +88,14 @@ html {
border: 1px solid $gray-500; border: 1px solid $gray-500;
input:not(:focus) { input:not(:focus) {
+ label { + label {
border: none;
box-shadow: 0 0 0 1px $gray-500; box-shadow: 0 0 0 1px $gray-500;
border-radius: .5rem; border-radius: .5rem;
} }
} }
input:checked:focus { input:checked:focus {
+ label { + label {
border: none;
box-shadow: 0 0 0 2.5px $blue; box-shadow: 0 0 0 2.5px $blue;
border-radius: .5rem; border-radius: .5rem;
} }