Merge branch 'develop' into defect/CSR-1494

This commit is contained in:
Leah Schumann 2023-06-30 07:35:30 -04:00
commit 9a88b08f02
19 changed files with 67 additions and 60 deletions

View file

@ -1,9 +1,6 @@
import { shallowMount, mount } from "@vue/test-utils";
import buttonQuestion from "./button-question";
import { getMountOptions } from "@/helpers/unit-test-helper.js";
import crypto from "crypto";
global.crypto = crypto;
describe("buttonQuestion.vue", () => {
it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => {

View file

@ -1,6 +1,5 @@
import { shallowMount } from "@vue/test-utils";
import dropdownQuestion from "./dropdown-question";
import crypto from "crypto";
// Mock CMS content
const questionText = "Question Text";
@ -12,8 +11,6 @@ const mockMixin = {
},
};
global.crypto = crypto;
// TODO: Remove the following from dropdown-question.vue -> :class="(errors && errors.length) || hasError ? 'has-error' : ''"
// It is not being used.
describe("dropdownQuestion.vue", () => {

View file

@ -30,28 +30,26 @@
<script>
import { useField } from "vee-validate";
import { v4 as uuidv4 } from "uuid";
export default {
name: "dropdown-question",
props: {
modelValue: String,
customInputId: String,
customDropdownId: String,
options: {
type: Object,
required: true,
},
modelValue: String,
isDisabled: Boolean,
isRequired: Boolean,
validationRules: String,
cmsWidgetName: String,
hasError: Boolean,
placeHolderText: String,
customDropdownId: String,
},
setup(props) {
const dropdownId = !props.customDropdownId
? `dropdown-${crypto.randomUUID()}`
: props.customDropdownId;
const uuid = uuidv4();
const dropdownId = !props.customDropdownId ? `dropdown-${uuid}` : props.customDropdownId;
const propsClone = Object.assign({}, props);
const modelValue = propsClone.modelValue;

View file

@ -7,15 +7,13 @@ const mockMeta = (returnValue) => jest.fn(async () => Promise.resolve(returnValu
import { shallowMount } from "@vue/test-utils";
import modal from "./modal";
import crypto from "crypto";
import { useForm } from "vee-validate";
import { Modal } from "bootstrap";
const footerButtonText = "Sample footer text here.";
const headerText = "Sample header text here.";
global.crypto = crypto;
describe("modal.vue", () => {
it("Should display modal header text when headerText is defined", async () => {
// Arrange / Act

View file

@ -44,6 +44,7 @@
import modalButtonMain from "@/digital-components/modal/ux-components/modal-button-main/modal-button-main";
import { Modal } from "bootstrap";
import { useForm } from "vee-validate";
import { v4 as uuidv4 } from "uuid";
export default {
name: "modal",
@ -58,7 +59,9 @@ export default {
},
},
setup() {
const modalId = `modal-${crypto.randomUUID()}`;
const uuid = uuidv4();
const modalId = `modal-${uuid}`;
const { meta, validate, resetForm } = useForm();
return {

View file

@ -1,6 +1,5 @@
import { shallowMount } from "@vue/test-utils";
import textboxQuestion from "./textbox-question";
import crypto from "crypto";
// Mock CMS content
const questionText = "Question Text";
@ -13,8 +12,6 @@ const mockMixin = {
};
const maska = jest.fn();
global.crypto = crypto;
describe("textboxQuestion.vue", () => {
it("Should render a text input", async () => {
// Arrange

View file

@ -77,13 +77,14 @@
<script>
import { useField, validate } from "vee-validate";
import { storeActions } from "@/constants/store-actions";
import loader from "@/ux-components/loader/loader.vue";
import { ref } from "vue";
import { v4 as uuidv4 } from "uuid";
export default {
name: "textbox-question",
props: {
customInputId: String,
type: {
type: String,
default: "text",
@ -97,7 +98,6 @@ export default {
default: true,
},
modelValue: String,
customInputId: String,
isDisabled: Boolean,
isRequired: Boolean,
hasIcon: Boolean, // If input has an icon
@ -120,7 +120,8 @@ export default {
centerErrorMessage: Boolean,
},
setup(props) {
const inputId = !props.customInputId ? `input-${crypto.randomUUID()}` : props.customInputId;
const uuid = uuidv4();
const inputId = !props.customInputId ? `input-${uuid}` : props.customInputId;
const propsClone = Object.assign({}, props);
const modelValue = propsClone.modelValue;

View file

@ -1,5 +1,5 @@
// Components
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
import addressQuestions from "@/fmg-components/address-questions/address-questions";
import alert from "@/ux-components/alert/alert";
// Supporting Files

View file

@ -1,6 +1,6 @@
<template>
<div class="address-questions" role="application">
<div class="row mb-4">
<div class="address-questions">
<div class="row mb-4" aria-live="polite">
<div class="col">
<textboxQuestion
id="streetAddressField"

View file

@ -1,8 +1,5 @@
import { mount } from "@vue/test-utils";
import contentGroupModal from "./content-group-modal";
import crypto from "crypto";
global.crypto = crypto;
describe("content-group-modal.vue", () => {
it("Should display header text when HeaderText is defined in the CMS", async () => {

View file

@ -38,7 +38,7 @@
</template>
<script>
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
import addressQuestions from "@/fmg-components/address-questions/address-questions";
import textboxQuestion from "@/digital-components/textbox-question/textbox-question";
import { defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules";

View file

@ -215,7 +215,7 @@ export default {
const alertReasonsPromise = locationAlerts.methods.loadInitialData(
store.getters.order.serviceLocation.zipCodeCtu,
store.getters.order.serviceLocation.provider?.address?.zipCtu
store.getters.order.serviceLocation.provider?.address?.zipCodeCtu
);
// Settle promises and get results
const promiseResultMap = [

View file

@ -42,7 +42,8 @@ jest.mock("@/store", () => ({
streetAddress: null,
city: null,
state: null,
zip: null,
zipCode: null,
zipCodeCtu: null,
},
},
},

View file

@ -2,11 +2,6 @@ import mobileLocationModalQuestions from "./mobile-location-modal-questions";
import { mount, shallowMount } from "@vue/test-utils";
import { storeActions } from "@/constants/store-actions";
import { getMountOptions } from "@/helpers/unit-test-helper.js";
import modal from "@/digital-components/modal/modal";
import crypto from "crypto";
global.crypto = crypto;
const linkWidgetName = "linkWidgetName";
const modalWidgetName = "modalWidgetName";

View file

@ -64,7 +64,7 @@ import textLink from "@/ux-components/text-link/text-link";
import textBlock from "@/digital-components/text-block/text-block";
import modal from "@/digital-components/modal/modal";
import alert from "@/ux-components/alert/alert";
import addressQuestions from "@/layouts/address-lookup/customer-questions/address-questions/address-questions";
import addressQuestions from "@/fmg-components/address-questions/address-questions";
import vehicleProtectedQuestion from "@/layouts/service-location/mobile-location-modal-questions/vehicle-protected-question/vehicle-protected-question";
// Helpers
@ -76,6 +76,7 @@ import {
// Validation
import { useField } from "vee-validate";
import { v4 as uuidv4 } from "uuid";
export default {
name: "mobile-location-modal-questions",
@ -84,13 +85,13 @@ export default {
return {
internalModel: deepClone(this.modelValue),
displayInvalidZipAlert: false,
addressQuestionsKey: 0,
isModalOpened: false,
};
},
setup(props) {
const uuid = uuidv4();
const componentId = !props.customComponentId
? `component-${crypto.randomUUID()}`
? `component-${uuid}`
: props.customComponentId;
// Integrate this component as a single field with an object for it's value into the page level validation

View file

@ -393,8 +393,8 @@ export default {
streetAddress: this.selectedProvider?.address?.streetAddress,
city: this.selectedProvider?.address?.city,
state: this.selectedProvider?.address?.state,
zip: this.selectedProvider?.address?.zipCode,
zipCtu: this.selectedProvider?.address?.zipCodeCtu,
zipCode: this.selectedProvider?.address?.zipCode,
zipCodeCtu: this.selectedProvider?.address?.zipCodeCtu,
},
},
},

View file

@ -1,7 +1,5 @@
import { mount, shallowMount } from "@vue/test-utils";
import serviceZipModalQuestion from "./service-zip-modal-question";
import crypto from "crypto";
global.crypto = crypto;
jest.mock("@/digital-components/textbox-question/textbox-question", () => ({
getCmsContent: jest.fn((widgetName, cmsFieldName) => {

View file

@ -54,7 +54,8 @@ const getDefaultState = () => {
streetAddress: null,
city: null,
state: null,
zip: null,
zipCode: null,
zipCodeCtu: null,
},
},
},
@ -265,7 +266,8 @@ export const mutations = {
streetAddress: serviceLocationInfo.provider?.address?.streetAddress,
city: serviceLocationInfo.provider?.address?.city,
state: serviceLocationInfo.provider?.address?.state,
zip: serviceLocationInfo.provider?.address?.zip,
zipCode: serviceLocationInfo.provider?.address?.zipCode,
zipCodeCtu: serviceLocationInfo.provider?.address?.zipCodeCtu,
},
};
},
@ -380,7 +382,8 @@ export const mutations = {
streetAddress: null,
city: null,
state: null,
zip: null,
zipCode: null,
zipCodeCtu: null,
},
};
},
@ -469,8 +472,10 @@ export const mutations = {
sessionInformation.order.serviceLocation.provider?.address?.city;
state.order.serviceLocation.provider.address.state =
sessionInformation.order.serviceLocation.provider?.address?.state;
state.order.serviceLocation.provider.address.zip =
sessionInformation.order.serviceLocation.provider?.address?.zip;
state.order.serviceLocation.provider.address.zipCode =
sessionInformation.order.serviceLocation.provider?.address?.zipCode;
state.order.serviceLocation.provider.address.zipCodeCtu =
sessionInformation.order.serviceLocation.provider?.address?.zipCodeCtu;
state.order.payment.isInsurance = sessionInformation.order.payment.isInsurance;
state.order.payment.insuranceCoverage.isVerified =
@ -1406,8 +1411,8 @@ export const actions = {
order.serviceLocation.provider?.address?.streetAddress,
city: order.serviceLocation.provider?.address?.city,
state: order.serviceLocation.provider?.address?.state,
zip: order.serviceLocation.provider?.address?.zip,
zipCtu: order.serviceLocation.provider?.address?.zipCtu,
zipCode: order.serviceLocation.provider?.address?.zipCode,
zipCodeCtu: order.serviceLocation.provider?.address?.zipCodeCtu,
},
},
},
@ -1917,7 +1922,7 @@ export const actions = {
if (context.state.order.serviceLocation) {
if (
serviceLocationInfo.zipCode !== context.state.order.serviceLocation.zipCode ||
!deepEqual(
!providersEqual(
serviceLocationInfo.provider,
context.state.order.serviceLocation.provider
) ||
@ -2147,6 +2152,17 @@ function convertGlassPieceToBackEndCompatibleFormat(glassPieces) {
});
}
function providersEqual(providerA, providerB) {
return (
providerA.providerNumber === providerB.providerNumber &&
providerA.address?.city === providerB.address?.city &&
providerA.address?.state === providerB.address?.state &&
providerA.address?.streetAddress === providerB.address?.streetAddress &&
providerA.address?.zipCode === providerB.address?.zipCode
);
//TODO: Change back to deepEqual once zipCodeCtu is added to saveSession.
}
// This function will verify schedule info is still valid.
// check to see if we have an appointment date on the order object.
// if so, make sure it's not in the past. if in the past, clear schedule info in store.

View file

@ -1071,7 +1071,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
},
@ -1099,7 +1100,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
};
@ -1130,7 +1132,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
},
@ -1158,7 +1161,8 @@ describe("Actions", () => {
streetAddress: "321 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
};
@ -1189,7 +1193,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
},
@ -1217,7 +1222,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
};
@ -1248,7 +1254,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
},
@ -1276,7 +1283,8 @@ describe("Actions", () => {
streetAddress: "123 Test Lane",
city: "Columbus",
state: "OH",
zip: "43212",
zipCode: "43212",
zipCodeCtu: "01820",
},
},
};