From 45f048b9066f5ee3c69b51195f169d669e617dc1 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 16 Feb 2022 14:37:15 -0500 Subject: [PATCH 01/45] Basic auto-complete function complete with standard html elements --- .../address-lookup/address-lookup.spec.js | 0 src/layouts/address-lookup/address-lookup.vue | 81 ++++++ .../address-questions/address-questions.vue | 254 ++++++++++++++++++ .../customer-questions/customer-questions.vue | 57 ++++ .../email-question/email-question.vue | 12 + src/router/router-constants/fmgPage-values.js | 1 + 6 files changed, 405 insertions(+) create mode 100644 src/layouts/address-lookup/address-lookup.spec.js create mode 100644 src/layouts/address-lookup/address-lookup.vue create mode 100644 src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue create mode 100644 src/layouts/address-lookup/customer-questions/customer-questions.vue create mode 100644 src/layouts/address-lookup/customer-questions/email-question/email-question.vue diff --git a/src/layouts/address-lookup/address-lookup.spec.js b/src/layouts/address-lookup/address-lookup.spec.js new file mode 100644 index 000000000..e69de29bb diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue new file mode 100644 index 000000000..471c5bc23 --- /dev/null +++ b/src/layouts/address-lookup/address-lookup.vue @@ -0,0 +1,81 @@ + + + diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue new file mode 100644 index 000000000..8560e59c4 --- /dev/null +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -0,0 +1,254 @@ + + + \ No newline at end of file diff --git a/src/layouts/address-lookup/customer-questions/customer-questions.vue b/src/layouts/address-lookup/customer-questions/customer-questions.vue new file mode 100644 index 000000000..c1d8f8094 --- /dev/null +++ b/src/layouts/address-lookup/customer-questions/customer-questions.vue @@ -0,0 +1,57 @@ + + + \ No newline at end of file diff --git a/src/layouts/address-lookup/customer-questions/email-question/email-question.vue b/src/layouts/address-lookup/customer-questions/email-question/email-question.vue new file mode 100644 index 000000000..ac4f6fdb4 --- /dev/null +++ b/src/layouts/address-lookup/customer-questions/email-question/email-question.vue @@ -0,0 +1,12 @@ + \ No newline at end of file diff --git a/src/router/router-constants/fmgPage-values.js b/src/router/router-constants/fmgPage-values.js index 9b82cdf7e..ca4338b14 100644 --- a/src/router/router-constants/fmgPage-values.js +++ b/src/router/router-constants/fmgPage-values.js @@ -4,6 +4,7 @@ const fmgPageValues = { VEHICLE_MODEL: "vehicle-model", VEHICLE_STYLE: "vehicle-style", VEHICLE_DAMAGE: "vehicle-damage", + ADDRESS_LOOKUP: "address-lookup", }; export { fmgPageValues }; From 651f039be2064b0fca5dca38305f6d16e6e9d9a3 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 16 Feb 2022 14:54:05 -0500 Subject: [PATCH 02/45] Merging latest from develop From 025ae14047969d682abf7bbc781a80a9ccda08ba Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 22 Feb 2022 10:11:18 -0500 Subject: [PATCH 03/45] Progress checkin for Bryan to look at styling --- .../dropdown-question/dropdown-question.vue | 41 +++++ .../text-question/text-question.vue | 26 ++++ .../address-questions/address-questions.vue | 140 +++++++++--------- 3 files changed, 134 insertions(+), 73 deletions(-) create mode 100644 src/common-components/dropdown-question/dropdown-question.vue create mode 100644 src/common-components/text-question/text-question.vue diff --git a/src/common-components/dropdown-question/dropdown-question.vue b/src/common-components/dropdown-question/dropdown-question.vue new file mode 100644 index 000000000..3f1f6b047 --- /dev/null +++ b/src/common-components/dropdown-question/dropdown-question.vue @@ -0,0 +1,41 @@ + + + diff --git a/src/common-components/text-question/text-question.vue b/src/common-components/text-question/text-question.vue new file mode 100644 index 000000000..5a4b48b42 --- /dev/null +++ b/src/common-components/text-question/text-question.vue @@ -0,0 +1,26 @@ + + + diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index 8560e59c4..230551e38 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -2,87 +2,21 @@
- - +
- - +
- - +
@@ -109,6 +43,8 @@ diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 471c5bc23..924d6836b 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -26,56 +26,55 @@ import store from "@/store"; export default { name: "address-lookup", async beforeRouteEnter(to, from, next) { - // Call APIs - const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); + // Call APIs + const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage); - // Settle promises and get results - const promiseResultMap = [ - { - resultKey: "cmsContent", - promise: cmsContentPromise, - }, - ]; + // Settle promises and get results + const promiseResultMap = [ + { + resultKey: "cmsContent", + promise: cmsContentPromise, + }, + ]; - const resultMap = await settleAllPromises(promiseResultMap); + const resultMap = await settleAllPromises(promiseResultMap); - // Call the "next" function to complete the transition to this page. - next((vm) => { - vm.$refs.funnelHeader.initializeComponent( - resultMap.cmsContent.FunnelHeaderWidget - ); - vm.$refs.vehicleBanner.initializeComponent( - resultMap.cmsContent.VehicleBannerWidget - ); - vm.$refs.funnelSubHeader.initializeComponent( - resultMap.cmsContent.FunnelSubHeaderWidget - ); - vm.$refs.funnelFooter.initializeComponent( - resultMap.cmsContent.FunnelFooterWidget - ); - }); + // Call the "next" function to complete the transition to this page. + next((vm) => { + vm.$refs.funnelHeader.initializeComponent( + resultMap.cmsContent.FunnelHeaderWidget + ); + vm.$refs.vehicleBanner.initializeComponent( + resultMap.cmsContent.VehicleBannerWidget + ); + vm.$refs.funnelSubHeader.initializeComponent( + resultMap.cmsContent.FunnelSubHeaderWidget + ); + vm.$refs.funnelFooter.initializeComponent( + resultMap.cmsContent.FunnelFooterWidget + ); + }); }, data(){ - return { - selectedDamageLocations: [], - driverSideOptionsData: [], - } + return { + + } }, methods: { - arePagePrerequisitesValid() { - return store.getters.vehicle.carId !== null; - }, - resetDependentState() { - // Invokes - store.dispatch(storeActions.RESET_PARTS_AND_DEPS); - }, + arePagePrerequisitesValid() { + return store.getters.vehicle.carId !== null; + }, + resetDependentState() { + // Invokes + store.dispatch(storeActions.RESET_PARTS_AND_DEPS); + }, }, components: { - funnelHeader, - funnelFooter, - vehicleBanner, - funnelSubHeader, - customerQuestions, + funnelHeader, + funnelFooter, + vehicleBanner, + funnelSubHeader, + customerQuestions, }, }; diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index 230551e38..dc37d2168 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -2,7 +2,7 @@
- +
@@ -19,12 +19,7 @@
- - +
@@ -55,6 +50,9 @@ export default ({ showAddressFields: false, displayVerificationWarning: false, displayNoMatchWarning: false, + address: { + streetAddress: "", + }, streetAddress: "", city: "", state: "", @@ -168,13 +166,9 @@ export default ({ }); } else { - let city = document.querySelector("#city"); - let state = document.querySelector("#state"); - let zip = document.querySelector("#zip"); - - city.value = ""; - state.value = ""; - zip.value = ""; + self.city = ""; + self.state = ""; + self.zip = ""; self.displayVerificationWarning = false; self.displayNoMatchWarning = true; @@ -190,10 +184,7 @@ export default ({ } if (place && place.address_components) { - let address1 = ""; - let city = document.querySelector("#city"); - let state = document.querySelector("#state"); - let zip = document.querySelector("#zip"); + self.streetAddress= ""; self.showAddressFields = true; for (const component of place.address_components) { @@ -201,15 +192,15 @@ export default ({ switch (componentType) { case "street_number": { - address1 = `${component.long_name} ${address1}`; + self.streetAddress = component.long_name; break; } case "route": { - address1 += component.short_name; + self.streetAddress += ' ' + component.short_name; break; } case "locality": { - city.value = component.long_name; + self.city = component.long_name; break; } case "administrative_area_level_1": { @@ -217,14 +208,13 @@ export default ({ break; } case "postal_code": { - zip.value = component.long_name; + self.zip = component.long_name; break; } } } - - addressField1.value = address1; + self.displayVerificationWarning = false; self.displayNoMatchWarning = false; } diff --git a/src/layouts/address-lookup/customer-questions/customer-questions.vue b/src/layouts/address-lookup/customer-questions/customer-questions.vue index c1d8f8094..9be41ed55 100644 --- a/src/layouts/address-lookup/customer-questions/customer-questions.vue +++ b/src/layouts/address-lookup/customer-questions/customer-questions.vue @@ -1,23 +1,13 @@ + + \ No newline at end of file From 9ab7b7968213b306fc3583ca0bb0dc2321c77bff Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Thu, 24 Feb 2022 13:49:19 -0500 Subject: [PATCH 05/45] WIP: Cleanup and fixes related to styling merge and others --- .../dropdown-question/dropdown-question.vue | 4 ++- .../text-question/text-question.vue | 33 ------------------- .../textbox-question/textbox-question.vue | 27 ++++++++++++--- .../address-questions/address-questions.vue | 13 +++----- .../customer-questions/customer-questions.vue | 23 +++++++------ .../email-question/email-question.vue | 24 -------------- 6 files changed, 42 insertions(+), 82 deletions(-) delete mode 100644 src/common-components/text-question/text-question.vue delete mode 100644 src/layouts/address-lookup/customer-questions/email-question/email-question.vue diff --git a/src/common-components/dropdown-question/dropdown-question.vue b/src/common-components/dropdown-question/dropdown-question.vue index e593a61b9..68882467e 100644 --- a/src/common-components/dropdown-question/dropdown-question.vue +++ b/src/common-components/dropdown-question/dropdown-question.vue @@ -28,7 +28,9 @@ export default { options: { type: Object, required: true - }, + }, + isDisabled: Boolean, + isRequired: Boolean, }, data() { diff --git a/src/common-components/text-question/text-question.vue b/src/common-components/text-question/text-question.vue deleted file mode 100644 index 12bc58da6..000000000 --- a/src/common-components/text-question/text-question.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 9df4c19e7..0bd7d066b 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -1,22 +1,41 @@ diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index dc37d2168..b08887c02 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -2,14 +2,14 @@
- +
- +
@@ -19,7 +19,7 @@
- +
@@ -38,7 +38,7 @@ \ No newline at end of file diff --git a/src/layouts/address-lookup/customer-questions/email-question/email-question.vue b/src/layouts/address-lookup/customer-questions/email-question/email-question.vue deleted file mode 100644 index 0e6db4f3a..000000000 --- a/src/layouts/address-lookup/customer-questions/email-question/email-question.vue +++ /dev/null @@ -1,24 +0,0 @@ - - - \ No newline at end of file From ea038adcff702822ef51538a05c1ffdfb1ea4b10 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 25 Feb 2022 08:28:52 -0500 Subject: [PATCH 06/45] Added transition effect to appearance of address fields after auto-complete --- .../address-questions/address-questions.vue | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index b08887c02..70c5d6e40 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -6,23 +6,25 @@ -
-
-
- -
+ +
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
- -
-
-
- -
-
- -
-
-
+
Date: Fri, 25 Feb 2022 11:46:58 -0500 Subject: [PATCH 07/45] added optional input mask to textbox-question component --- package-lock.json | 11 +++++++++++ package.json | 1 + .../textbox-question/textbox-question.vue | 9 +++++++-- .../address-questions/address-questions.vue | 2 +- src/main.js | 2 ++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index bfc6c1f68..f209fd9fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ "core-js": "^3.6.5", "http-status-codes": "^2.1.4", "jest-junit": "^13.0.0", + "maska": "^1.5.0", "vee-validate": "^4.5.7", "vue": "^3.0.0", "vue-plugin-load-script": "^2.1.0", @@ -16625,6 +16626,11 @@ "node": ">=0.10.0" } }, + "node_modules/maska": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/maska/-/maska-1.5.0.tgz", + "integrity": "sha512-BwZXzs5gHeu6wtn3iWFqrKRtcsM3sTpkHvfAngVNVNlN7tl9ZyQUeHTz11s9Sy7Bq1MoQ+xyR/+IzghY8nR84Q==" + }, "node_modules/md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -37642,6 +37648,11 @@ "object-visit": "^1.0.0" } }, + "maska": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/maska/-/maska-1.5.0.tgz", + "integrity": "sha512-BwZXzs5gHeu6wtn3iWFqrKRtcsM3sTpkHvfAngVNVNlN7tl9ZyQUeHTz11s9Sy7Bq1MoQ+xyR/+IzghY8nR84Q==" + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", diff --git a/package.json b/package.json index 82561e1ca..ec3d65d79 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "core-js": "^3.6.5", "http-status-codes": "^2.1.4", "jest-junit": "^13.0.0", + "maska": "^1.5.0", "vee-validate": "^4.5.7", "vue": "^3.0.0", "vue-plugin-load-script": "^2.1.0", diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 0bd7d066b..cd25f3afd 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -1,7 +1,7 @@ - - From 0bcd842affb608284c3151e15ed868ec12459b71 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Fri, 11 Mar 2022 10:40:50 -0500 Subject: [PATCH 16/45] CSR-319: remove console logs / comments --- src/mixins/base-mixin.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/mixins/base-mixin.js b/src/mixins/base-mixin.js index 451738c37..f54909d06 100644 --- a/src/mixins/base-mixin.js +++ b/src/mixins/base-mixin.js @@ -23,20 +23,13 @@ export default { }, onSubmit() {}, // DO NOT REMOVE; needed to prevent default form submit behavior onInvalidSubmit({ values, errors, results }) { - console.log('errors: ', errors) - // {DamageLocationQuestion: 'Please select damage location'} - // {driverSideOptions: 'Please select window', passengerSideOptions: 'Please select window'} - - // identify the first error field and put focus on it // get error names array const errorNames = errors ? Object.keys(errors) : []; const firstErrorEl = errorNames[0]; if (firstErrorEl) { - console.log('firstErrorEl: ', firstErrorEl) const qsString = "[data-focus-target='" + firstErrorEl + "']"; const el = document.querySelector(qsString); - console.log('el is: ', el) el && el.focus(); } }, From 2ffc311f22d01bf3b1cb3b36aa041d1b402901c3 Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 11 Mar 2022 16:03:38 -0500 Subject: [PATCH 17/45] Update vin-lookup page. --- src/layouts/vin-lookup/vin-lookup.vue | 17 +++++++++ src/router/router-constants/routing-table.js | 13 +++++++ src/store/index.js | 38 +++++++++++++++++++- 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index aa179439a..635f0aef5 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -33,6 +33,7 @@ import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { settleAllPromises } from "@/helpers/layout-helper"; import { storeActions } from "@/constants/store-actions"; import store from "@/store"; +import { storeMutations } from "@/constants/store-mutations"; import baseMixin from "@/mixins/base-mixin"; import { Form, defineRule } from "vee-validate"; import { required } from "@/helpers/validation-rules"; @@ -86,6 +87,22 @@ export default { arePagePrerequisitesValid() { return true; }, + resetDependentState() { + store.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, null); + store.commit(storeMutations.UPDATE_REGISTRATION_CITY, null); + store.commit(storeMutations.UPDATE_REGISTRATION_STATE, null); + store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, null); + store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, null); + store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); + store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, null); + }, + backButtonAction() { + // route to move backwards + this.$router.navigate( + this.navigationScenarios.CLICKED_BACK, + this.$route + ); + }, }, components: { funnelHeader, diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 3bd937c41..584796a61 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -97,6 +97,19 @@ const routingTable = [ }, ], }, + { + fmgPageValue: fmgPageValues.VIN_LOOKUP, + maps: [ + { + scenario: navigationScenarios.CLICKED_BACK, + destinationFmgPageValue: fmgPageValues.VEHICLE_DAMAGE, + }, + { + scenario: navigationScenarios.VIN_LOOKUP, + destinationFmgPageValue: fmgPageValues.PART_QUESTIONS, + }, + ], + }, ]; export { routingTable }; diff --git a/src/store/index.js b/src/store/index.js index a00f550be..5ffdc168a 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -19,6 +19,15 @@ export const state = { imageUrl: null, imageVifNumber: null, imageColor: null, + registration: { + licensePlate: null, + address: null, + city: null, + state: null, + zipCode: null, + firstName: null, + lastName: null, + }, }, damage: { isRepair: null, @@ -81,6 +90,33 @@ export const mutations = { updatePageData(state, pageData){ state.applicationUser.pageData[pageData.page] = pageData.data; }, + updateRegistrationAddress(state, registrationAddress){ + state.order.vehicle.registration.address = registrationAddress; + }, + updateRegistrationCity(state, registrationCity){ + state.order.vehicle.registration.city = registrationCity; + }, + updateRegistrationState(state, registrationState){ + state.order.vehicle.registration.state = registrationState; + }, + updateRegistrationZipCode(state, registrationZipCode){ + state.order.vehicle.registration.zipCode = registrationZipCode; + }, + updateRegistrationFirstName(state, registrationFirstName){ + state.order.vehicle.registration.firstName = registrationFirstName; + }, + updateRegistrationLastName(state, registrationLastName){ + state.order.vehicle.registration.lastName = registrationLastName; + }, + updateRegistrationLicensePlate(state, registrationLicensePlate){ + state.order.vehicle.registration.licensePlate = registrationLicensePlate; + }, + updateServiceLocationZip(state, ServiceLocationZip){ + state.order.vehicle.serviceLocation.zip = ServiceLocationZip; + }, + updateCustomerEmailAddress(state, CustomerEmailAddress){ + state.order.vehicle.customer.emailAddress = CustomerEmailAddress; + }, // EVENT BUS MUTATIONS addEventToBus(state, event) { @@ -288,4 +324,4 @@ export default createStore({ mutations, getters, actions, -}); \ No newline at end of file +}); From 21597f3f750114806856fe23afa32fffa34cb4e7 Mon Sep 17 00:00:00 2001 From: bmauger Date: Fri, 11 Mar 2022 16:12:21 -0500 Subject: [PATCH 18/45] Change to camelCase. --- src/store/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 5ffdc168a..2eead09e1 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -112,10 +112,10 @@ export const mutations = { state.order.vehicle.registration.licensePlate = registrationLicensePlate; }, updateServiceLocationZip(state, ServiceLocationZip){ - state.order.vehicle.serviceLocation.zip = ServiceLocationZip; + state.order.vehicle.serviceLocation.zip = serviceLocationZip; }, updateCustomerEmailAddress(state, CustomerEmailAddress){ - state.order.vehicle.customer.emailAddress = CustomerEmailAddress; + state.order.vehicle.customer.emailAddress = customerEmailAddress; }, // EVENT BUS MUTATIONS From 4a32ca1f981ffb14af7f4cf128348cc51e0ff5d8 Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 14 Mar 2022 13:55:46 -0400 Subject: [PATCH 19/45] Update unit test. --- src/layouts/vin-lookup/vin-lookup.spec.js | 168 +++++++++++++++++++++- src/layouts/vin-lookup/vin-lookup.vue | 26 ++-- src/store/index.js | 8 +- 3 files changed, 184 insertions(+), 18 deletions(-) diff --git a/src/layouts/vin-lookup/vin-lookup.spec.js b/src/layouts/vin-lookup/vin-lookup.spec.js index 3d0843e10..1db5c18a6 100644 --- a/src/layouts/vin-lookup/vin-lookup.spec.js +++ b/src/layouts/vin-lookup/vin-lookup.spec.js @@ -1 +1,167 @@ -test.todo("some test to be written in the future"); +// Components +import vinLookup from "@/layouts/vin-lookup/vin-lookup.vue"; +import vehicleDamage from "@/layouts/vehicle-damage/vehicle-damage.vue"; +import funnelHeader from "@/common-components/funnel-header/funnel-header"; +import funnelFooter from "@/common-components/funnel-footer/funnel-footer"; +import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner"; +import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header"; +import sideDoorOptions from "@/layouts/vehicle-damage/side-door-options/side-door-options"; +import damageLocationQuestion from "@/layouts/vehicle-damage/damage-location-question/damage-location-question"; +import windshieldOptions from "@/layouts/vehicle-damage/windshield-options/windshield-options"; +import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question"; + +// Supporting Files +import { settleAllPromises } from "@/helpers/layout-helper.js"; +import baseMixin from "@/mixins/base-mixin"; +import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; +import { mount, flushPromises } from "@vue/test-utils"; +import { getMountOptions } from "@/helpers/unit-test-helper.js"; +import { nextTick } from "vue"; +import { storeActions } from "@/constants/store-actions"; +import { storeMutations } from "@/constants/store-mutations"; +import store from "@/store"; +import { validate } from "vee-validate"; +import { damageLocationsSelected } from "@/constants/damage-locations-selected.js"; + +// Mock our module for promises. +jest.mock("@/helpers/layout-helper.js", () => ({ + settleAllPromises: jest.fn(), +})); + +// Mock fetchCmsContentForPage +jest.mock("@/helpers/cms-content-helper", () => ({ + fetchCmsContentForPage: jest.fn(), +})); + +// Mock Store +jest.mock("@/store", () => ({ + commit: jest.fn(), + dispatch: jest.fn(), + getters: { + vehicle: { + carId: "C00000000", + image: "test.jpg", + }, + eventBusItem: jest.fn(), + damage: { + glassToReplace: [] + }, + }, +})); + +describe("vin-lookup.vue", () => { + + test("Call resetDependentState", async() => { + const {wrapper} = setupMocks({}); + wrapper.vm.resetDependentState(); + expect(store.dispatch).toBeCalledWith(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); + }); + +}); + +// TEMP +function setupMocks({ + pageHeaderWidgetHeaderText = {}, + mountOptionsMockData = { + router: { + navigate: jest.fn(), + }, + store: { + getters: { + vehicle: {}, + }, + }, + }, +}) { + //Mock api responses + baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn(); + const apiResponses = { + cmsContent: { + FunnelSubHeaderWidget: pageHeaderWidgetHeaderText, + VehicleBannerWidget: { + GenericVehicleImage: + "https://digitalconsumercms-dev.safelite.com/images/default-source/default-album/blurred-image.jpg?sfvrsn=a6ce3034_3", + }, + FunnelHeaderWidget: { + LogoImage: + "https://digitalconsumercms-dev.safelite.com/images/default-source/default-album/safelite-logo.svg?sfvrsn=45e7ed06_3", + }, + }, + damageOptions: { + driverSideOptions: { + availableReplacementOptions: ["Front", "Back", "Side"], + }, + passengerSideOptions: { + availableReplacementOptions: ["Front", "Back", "Side"], + }, + windshieldOptions: { + availableReplacementOptions: ["Single", "Driver", "Passenger"], + }, + backGlassOptions: { + availableReplacementOptions: ["Front", "Back", "Side"], + }, + }, + }; + + const apiPromise = Promise.resolve(apiResponses); + + settleAllPromises.mockImplementation(() => apiPromise); + fetchCmsContentForPage.mockImplementation(() => Promise.resolve()); + + //Mock damage initialize methods + funnelHeader.methods = { + initializeComponent: jest.fn(), + }; + + vehicleBanner.methods = { + initializeComponent: jest.fn(), + }; + + funnelSubHeader.methods = { + initializeComponent: jest.fn(), + }; + + damageLocationQuestion.methods = { + initializeComponent: jest.fn(), + }; + + sideDoorOptions.methods = { + initializeComponent: jest.fn(), + }; + + windshieldOptions.methods = { + initializeComponent: jest.fn(), + }; + + replaceOptionsQuestion.methods = { + initializeComponent: jest.fn(), + updateSelectedValues: jest.fn(), + }; + + funnelFooter.methods = { + initializeComponent: jest.fn(), + } + + const mountOptions = getMountOptions(mountOptionsMockData); + mountOptions['attachTo'] = document.body; // append wrapper to document.body to test DOM methods + + const wrapper = mount(vinLookup, mountOptions); + + const funnelHeaderWrapper = wrapper.findComponent({ name: "funnelHeader" }); + funnelHeaderWrapper.vm.initializeComponent = + funnelHeader.methods.initializeComponent; + + const vehicleBannerWrapper = wrapper.findComponent({ name: "vehicleBanner" }); + vehicleBannerWrapper.vm.initializeComponent = + vehicleBanner.methods.initializeComponent; + + const funnelSubHeaderWrapper = wrapper.findComponent({ name: "funnelSubHeader" }); + funnelSubHeaderWrapper.vm.initializeComponent = + funnelSubHeader.methods.initializeComponent; + + const funnelFooterWrapper = wrapper.findComponent({ name: "funnelFooter" }); + funnelFooterWrapper.vm.initializeComponent = + funnelFooter.methods.initializeComponent; + + return { wrapper, apiPromise }; +} diff --git a/src/layouts/vin-lookup/vin-lookup.vue b/src/layouts/vin-lookup/vin-lookup.vue index 635f0aef5..8dbb6cdc9 100644 --- a/src/layouts/vin-lookup/vin-lookup.vue +++ b/src/layouts/vin-lookup/vin-lookup.vue @@ -5,17 +5,17 @@

VIN Lookup Placeholder Page

@@ -88,13 +88,7 @@ export default { return true; }, resetDependentState() { - store.commit(storeMutations.UPDATE_REGISTRATION_ADDRESS, null); - store.commit(storeMutations.UPDATE_REGISTRATION_CITY, null); - store.commit(storeMutations.UPDATE_REGISTRATION_STATE, null); - store.commit(storeMutations.UPDATE_REGISTRATION_ZIP_CODE, null); - store.commit(storeMutations.UPDATE_REGISTRATION_FIRST_NAME, null); - store.commit(storeMutations.UPDATE_REGISTRATION_LAST_NAME, null); - store.commit(storeMutations.UPDATE_REGISTRATION_LICENSE_PLATE, null); + store.dispatch(storeActions.RESET_REGISTRATION_STATE_AND_DEPENDENCIES); }, backButtonAction() { // route to move backwards diff --git a/src/store/index.js b/src/store/index.js index 2eead09e1..65e5a06c7 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -151,7 +151,13 @@ export const mutations = { state.order.damage.glassToReplace = null; }, resetRegistrationState(state) { - + state.order.vehicle.registration.licensePlate = null; + state.order.vehicle.registration.address = null; + state.order.vehicle.registration.city = null; + state.order.vehicle.registration.state = null; + state.order.vehicle.registration.zipCode = null; + state.order.vehicle.registration.firstName = null; + state.order.vehicle.registration.lastName = null; }, resetPartsState(state) { state.order.lineItems.glassParts = null; From 735902c4fa9b07013a8459d5937eaaa29bc76796 Mon Sep 17 00:00:00 2001 From: bmauger Date: Mon, 14 Mar 2022 15:33:40 -0400 Subject: [PATCH 20/45] Fix error. --- src/store/index.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 65e5a06c7..53e977114 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -29,6 +29,12 @@ export const state = { lastName: null, }, }, + serviceLocation: { + zip: null, + }, + customer: { + emailAddress: null, + }, damage: { isRepair: null, numberOfChips: null, @@ -111,10 +117,10 @@ export const mutations = { updateRegistrationLicensePlate(state, registrationLicensePlate){ state.order.vehicle.registration.licensePlate = registrationLicensePlate; }, - updateServiceLocationZip(state, ServiceLocationZip){ + updateServiceLocationZip(state, serviceLocationZip){ state.order.vehicle.serviceLocation.zip = serviceLocationZip; }, - updateCustomerEmailAddress(state, CustomerEmailAddress){ + updateCustomerEmailAddress(state, customerEmailAddress){ state.order.vehicle.customer.emailAddress = customerEmailAddress; }, From acc9518675b0e50e4c23ce60a6cb48ff8421112c Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 15 Mar 2022 13:21:42 -0400 Subject: [PATCH 21/45] CSR-319: fix syncing error between selectedValues and validation values --- .../list-button-horizontal.vue | 9 +++++++-- .../list-button/list-button.spec.js | 7 ++++++- src/ux-components/list-button/list-button.vue | 18 +++++++++++++++--- src/ux-components/list-card/list-card.spec.js | 15 +++++++++++++++ src/ux-components/list-card/list-card.vue | 11 ++++++++--- 5 files changed, 51 insertions(+), 9 deletions(-) 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 8ef069c2b..68aceec51 100644 --- a/src/ux-components/list-button-horizontal/list-button-horizontal.vue +++ b/src/ux-components/list-button-horizontal/list-button-horizontal.vue @@ -109,11 +109,15 @@ export default { const fieldOptions = { type: inputType, checkedValue: props.value, + potentialInitialValue: props.selectedValues, }; - if (Array.isArray(props.selectedValues) && props.selectedValues.length == 1) { - fieldOptions['initialValue'] = fieldOptions.checkedValue; + // Set initialValue for validation setup if pre-selected + // NOTE: props.selectedValues could be an array of strings, or an array of integers... + if (props.selectedValues && (props.selectedValues.includes(props.value) || props.selectedValues.includes(parseInt(props.value)))) { + fieldOptions['initialValue'] = fieldOptions.potentialInitialValue; } + const { checked, handleChange, @@ -124,6 +128,7 @@ export default { checked, handleChange, errors, + fieldOptions, // only need to expose this for unit test purposes }; }, }; diff --git a/src/ux-components/list-button/list-button.spec.js b/src/ux-components/list-button/list-button.spec.js index 18707e45f..7cc885b49 100644 --- a/src/ux-components/list-button/list-button.spec.js +++ b/src/ux-components/list-button/list-button.spec.js @@ -166,11 +166,15 @@ describe("list-button.vue", () => { isRequired: true, isWide: false, modelValue: ["List Card Checkbox"], + buttonID: 'list-card-id' }, }); + wrapper.vm.handleCheckChange(); + // Assert - expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: Boolean}]); + expect(wrapper.emitted()["isCheckedChanged"][0]).toEqual([{value: "List Card Checkbox", checkValue: Boolean, buttonId: 'list-card-id'}]); + }); it("Should set checkValue data if selectedButtonIDs has value(s)", async () => { @@ -192,4 +196,5 @@ describe("list-button.vue", () => { // Assert expect(wrapper.componentVM.checkValue).toEqual("Car-Front"); }); + }); diff --git a/src/ux-components/list-button/list-button.vue b/src/ux-components/list-button/list-button.vue index 3a8e65fc0..caef528de 100644 --- a/src/ux-components/list-button/list-button.vue +++ b/src/ux-components/list-button/list-button.vue @@ -100,7 +100,13 @@ export default { handleCheckChange(newValue, oldValue){ const isInitialization = typeof(oldValue) === 'function'; if (!isInitialization) { - this.$emit('isCheckedChanged', { checkValue: this.checkValue, value: this.value.toString() }); + const emitEvent = { + checkValue: this.checkValue, + value: this.value.toString(), + buttonId: this.buttonID.toString(), + }; + this.$emit('isCheckedChanged', emitEvent); + this.$emit("update:modelValue", emitEvent); } }, }, @@ -109,14 +115,19 @@ export default { }, setup(props) { const inputType = props.isMultiSelect ? "checkbox" : "radio"; + const fieldOptions = { type: inputType, checkedValue: props.value, + potentialInitialValue: props.selectedValues, }; - if (Array.isArray(props.selectedValues) && props.selectedValues.length == 1) { - fieldOptions['initialValue'] = fieldOptions.checkedValue; + // Set initialValue for validation setup if pre-selected + // NOTE: props.selectedValues could be an array of strings, or an array of integers... + if (props.selectedValues && (props.selectedValues.includes(props.value) || props.selectedValues.includes(parseInt(props.value)))) { + fieldOptions['initialValue'] = fieldOptions.potentialInitialValue; } + const { checked, handleChange, @@ -127,6 +138,7 @@ export default { checked, handleChange, errors, + fieldOptions, // only need to expose this for unit test purposes }; }, }; diff --git a/src/ux-components/list-card/list-card.spec.js b/src/ux-components/list-card/list-card.spec.js index 743392ee8..11f24abbb 100644 --- a/src/ux-components/list-card/list-card.spec.js +++ b/src/ux-components/list-card/list-card.spec.js @@ -232,5 +232,20 @@ describe("list-card.vue", () => { expect(wrapper.componentVM.checkValue).toEqual("Car-Front"); }); + it("Should set an initial value for validation if selectedValues include the value", async () => { + // Arrange + const wrapper = shallowMount(listCard, { + propsData: { + value: "Windshield", + groupName: "radio 1", + modelValue: ["Windshield"], + selectedValues: ["Windshield"], + }, + }); + + // Assert + expect(wrapper.vm.fieldOptions.initialValue).toEqual([ 'Windshield' ]); + }); + }); diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue index 8e88c4b68..d3a1fc712 100644 --- a/src/ux-components/list-card/list-card.vue +++ b/src/ux-components/list-card/list-card.vue @@ -58,6 +58,7 @@ From bfbe8aa5f024ced970d00a934aa8c9c88031d551 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 16 Mar 2022 11:46:27 -0400 Subject: [PATCH 23/45] CMS related coding changes for textbox-question and dropdown-question --- .../dropdown-question/dropdown-question.vue | 23 ++++++-- .../textbox-question/textbox-question.vue | 34 +++++++++-- src/layouts/address-lookup/address-lookup.vue | 16 ++++- .../address-questions/address-questions.vue | 58 +++++++++---------- .../customer-questions/customer-questions.vue | 15 +++-- 5 files changed, 98 insertions(+), 48 deletions(-) diff --git a/src/common-components/dropdown-question/dropdown-question.vue b/src/common-components/dropdown-question/dropdown-question.vue index 91924c1db..d5050f74b 100644 --- a/src/common-components/dropdown-question/dropdown-question.vue +++ b/src/common-components/dropdown-question/dropdown-question.vue @@ -1,6 +1,6 @@ @@ -54,8 +56,16 @@ export default { resultMap.cmsContent.FunnelFooterWidget ); vm.$refs.customerQuestions.initializeComponent([ + resultMap.cmsContent.StreetAddressQuestionWidget, + resultMap.cmsContent.CityQuestionWidget, + resultMap.cmsContent.StateQuestionWidget, + resultMap.cmsContent.ZipQuestionWidget, resultMap.cmsContent.AlertVerificationWarningWidget, - resultMap.cmsContent.AlertNoMatchWarningWidget + resultMap.cmsContent.AlertNoMatchWarningWidget, + resultMap.cmsContent.FirstNameQuestionWidget, + resultMap.cmsContent.LastNameQuestionWidget, + resultMap.cmsContent.EmailAddressQuestionWidget, + ] ); }); diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index 4e4971f12..f347264b4 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -1,28 +1,26 @@ @@ -20,7 +20,6 @@ diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 7b71fe185..14c881dce 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -1,129 +1,129 @@ diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index b3a4fa97f..9914c406c 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -1,16 +1,17 @@ diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index f347264b4..936eb09b6 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -1,38 +1,38 @@ \ No newline at end of file diff --git a/src/layouts/address-lookup/customer-questions/customer-questions.vue b/src/layouts/address-lookup/customer-questions/customer-questions.vue index 9135c461a..27a7e5486 100644 --- a/src/layouts/address-lookup/customer-questions/customer-questions.vue +++ b/src/layouts/address-lookup/customer-questions/customer-questions.vue @@ -1,59 +1,85 @@ \ No newline at end of file From 8bd0df4917a1c3396014349b27b889ef225226bc Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Fri, 18 Mar 2022 08:56:39 -0400 Subject: [PATCH 26/45] Added some validation related stuff --- .../dropdown-question/dropdown-question.vue | 4 +- .../textbox-question/textbox-question.vue | 4 +- src/constants/error-messages.js | 7 ++ .../address-questions/address-questions.vue | 3 +- .../customer-questions/customer-questions.vue | 111 +++++++++--------- 5 files changed, 72 insertions(+), 57 deletions(-) diff --git a/src/common-components/dropdown-question/dropdown-question.vue b/src/common-components/dropdown-question/dropdown-question.vue index 81812b72a..38cf15985 100644 --- a/src/common-components/dropdown-question/dropdown-question.vue +++ b/src/common-components/dropdown-question/dropdown-question.vue @@ -7,7 +7,8 @@ :name="inputId" :aria-disabled="isDisabled" :disabled="isDisabled" - :aria-required="isRequired"> + :aria-required="isRequired" + :validationRules="validationRules" > @@ -33,6 +34,7 @@ export default { isDisabled: Boolean, isRequired: Boolean, disableAutoFill: Boolean, + validationRules: String, }, data() { return { diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 14c881dce..18f2851c5 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -13,7 +13,8 @@ :disabled="isDisabled" :aria-required="isRequired" autocomplete="off" - :class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']" /> + :class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']" + :validationRules="validationRules" />

There has been an error!

@@ -45,6 +46,7 @@ export default { type: String, default: '', }, + validationRules: String, }, data() { return { diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index ba2b0e585..1fd2a77c2 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -7,6 +7,13 @@ const errorMessages = { WINDSHIELD_CHIP_COUNT_REQUIRED: "Please select chip(s)", WINSHIELD_REPLACE_OPTIONS_REQUIRED: "Please select windshield part", REPLACE_OPTIONS_REQUIRED: "Please select rear window type", + STREET_ADDRESS_REQUIRED: "Please enter your street address", + CITY_REQUIRED: "Please enter your city", + STATE_REQUIRED: "Please enter your state", + ZIP_REQUIRED: "Please enter your ZIP", + FIRST_NAME_REQUIRED: "Please enter your first name", + LAST_NAME_REQUIRED: "Please enter your last name", + EMAIL_ADDRESS_REQUIRED: "Please enter your email address", }; export { errorMessages }; \ No newline at end of file diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index 936eb09b6..20dae6350 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -55,7 +55,8 @@ export default ({ state: "", zip: "", }), - }, + }, + validationRules: String, }, setup(props, { emit }) { const addressModel = computed({ // Use computed to wrap the object diff --git a/src/layouts/address-lookup/customer-questions/customer-questions.vue b/src/layouts/address-lookup/customer-questions/customer-questions.vue index 27a7e5486..c50be3405 100644 --- a/src/layouts/address-lookup/customer-questions/customer-questions.vue +++ b/src/layouts/address-lookup/customer-questions/customer-questions.vue @@ -24,62 +24,65 @@ import { computed } from 'vue'; //import store from "@/store"; export default ({ - name: "customer-questions", - emits: ['update:modelValue'], // The component emits an event - props: { - modelValue: { - type: Object, - default: () => ({ - customerQuestions: { - addressQuestions: { - streetAddress: "", - city: "", - state: "", - zip: "", - }, - firstName: "", - lastName: "", - emailAddress: "", - } - }), - } - }, - data(){ - return { - - } - }, - setup(props, { emit }) { - const customerModel = computed({ // Use computed to wrap the object - get: () => props.modelValue, - set: (value) => emit('update:modelValue', value), - }); - - return { customerModel }; - }, - methods: { - initializeComponent(cmsContent){ - // pass alert texts to addressQuestions component - this.$refs.addressQuestions.initializeComponent(cmsContent); - - this.$refs.firstName.initializeComponent(cmsContent[6].QuestionText); - this.$refs.lastName.initializeComponent(cmsContent[7].QuestionText); - this.$refs.emailAddress.initializeComponent(cmsContent[8].QuestionText); - } - }, - computed: { - value: { - get: function() { - return this.modelValue; + name: "customer-questions", + emits: ['update:modelValue'], // The component emits an event + props: { + modelValue: { + type: Object, + default: () => ({ + customerQuestions: { + addressQuestions: { + streetAddress: "", + city: "", + state: "", + zip: "", }, - set: function(newValue) { - this.$emit("update:modelValue", newValue); - } - }, + firstName: "", + lastName: "", + emailAddress: "", + } + }), }, - components: { - addressQuestions, - textboxQuestion, + validationRules: String, + }, + data() { + return { + } + }, + setup(props, { emit }) { + // Please do not modify, this "computed" is used to track and report + // this object's property changes to the parent component + const customerModel = computed({ // Use computed to wrap the object + get: () => props.modelValue, + set: (value) => emit('update:modelValue', value), + }); + + return { customerModel }; + }, + methods: { + initializeComponent(cmsContent){ + // pass alert texts to addressQuestions component + this.$refs.addressQuestions.initializeComponent(cmsContent); + + this.$refs.firstName.initializeComponent(cmsContent[6].QuestionText); + this.$refs.lastName.initializeComponent(cmsContent[7].QuestionText); + this.$refs.emailAddress.initializeComponent(cmsContent[8].QuestionText); + } + }, + computed: { + value: { + get: function() { + return this.modelValue; + }, + set: function(newValue) { + this.$emit("update:modelValue", newValue); + } + }, + }, + components: { + addressQuestions, + textboxQuestion, + } }) \ No newline at end of file From 6a7fc87235b7dd7c50a5d0172588387fe38a166f Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Sat, 19 Mar 2022 10:23:01 -0400 Subject: [PATCH 27/45] CSR-262: fix button error outline styling --- src/styles/common-error-styles.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss index 42c8e499c..494c97c48 100644 --- a/src/styles/common-error-styles.scss +++ b/src/styles/common-error-styles.scss @@ -1,7 +1,7 @@ .has-error { &.list-button, &.list-card { - border: 1px solid $gray-500; + border: 1px solid $red; color: $red; label { box-shadow: 0 0 1px $red; From de4461668090334ac5bbdddeb75b45fd7171b814 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Sat, 19 Mar 2022 10:29:55 -0400 Subject: [PATCH 28/45] CSR-262: fix missing focus outline on checked buttons --- src/ux-components/list-card/list-card.vue | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/ux-components/list-card/list-card.vue b/src/ux-components/list-card/list-card.vue index d3a1fc712..a9755904e 100644 --- a/src/ux-components/list-card/list-card.vue +++ b/src/ux-components/list-card/list-card.vue @@ -209,17 +209,23 @@ export default { } } - &:focus + label { - box-shadow: 0 0 0 2.5px $blue; - border-radius: 0.5rem; - } - &:checked + label { background: $blue-100; box-shadow: 0 0 0 1px $blue; border-radius: 0.5rem; } + &:focus + label { + box-shadow: 0 0 0 2.5px $blue; + border-radius: 0.5rem; + } + + &:checked { + &:focus + label { + box-shadow: 0 0 0 2.5px $blue; + } + } + &:checked + label { p { color: $black; From ed1188ca5afc892e5b59b0418bbda63253b4b110 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Sat, 19 Mar 2022 10:51:10 -0400 Subject: [PATCH 29/45] CSR-262: add thickened border styling on has-error buttons that get focused --- src/styles/common-error-styles.scss | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss index 494c97c48..496055619 100644 --- a/src/styles/common-error-styles.scss +++ b/src/styles/common-error-styles.scss @@ -7,9 +7,12 @@ box-shadow: 0 0 1px $red; border-radius: .5rem; } + input[type=checkbox]:focus + label, + input[type=radio]:focus + label { + box-shadow: 0 0 0 2.5px $red; + } } - input[type=checkbox]:focus + label, - input[type=radio]:focus + label, + input[type=checkbox]:checked + label, input[type=radio]:checked + label { box-shadow: 0 0 0 2.5px transparent !important; From b769f95d56bda12dfee1642d732dd43412bbab03 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 21 Mar 2022 10:39:35 -0400 Subject: [PATCH 30/45] Added validation to address-lookup --- .../dropdown-question/dropdown-question.vue | 39 ++++++++-- .../textbox-question/textbox-question.vue | 76 ++++++++++++++----- src/constants/error-messages.js | 1 + src/helpers/validation-rules.js | 17 +++++ src/layouts/address-lookup/address-lookup.vue | 26 +++++-- .../address-questions/address-questions.vue | 26 +++++-- .../customer-questions/customer-questions.vue | 18 ++++- 7 files changed, 162 insertions(+), 41 deletions(-) diff --git a/src/common-components/dropdown-question/dropdown-question.vue b/src/common-components/dropdown-question/dropdown-question.vue index 38cf15985..f5fdf1983 100644 --- a/src/common-components/dropdown-question/dropdown-question.vue +++ b/src/common-components/dropdown-question/dropdown-question.vue @@ -8,14 +8,16 @@ :aria-disabled="isDisabled" :disabled="isDisabled" :aria-required="isRequired" - :validationRules="validationRules" > + :validationRules="validationRules" + @input="handleChange" + @blur="handleBlur" > -

- There has been an error! -

+
+ {{ errorMessage }} +
@@ -36,10 +38,30 @@ export default { disableAutoFill: Boolean, validationRules: String, }, + setup(props) { + const fieldOptions = { + type: "text", + value: props.modelValue, + }; + + const { + errorMessage, + handleBlur, + handleChange, + meta, + } = useField(props.inputId, props.validationRules, fieldOptions); + + return { + errorMessage, + handleBlur, + handleChange, + meta, + }; + }, data() { return { - labelText: "", - ariaLabelText: "", + labelText: "", + ariaLabelText: "", } }, methods: { @@ -65,6 +87,11 @@ export default { } }, }, + watch: { + selectedOption(newValue) { + this.handleChange(newValue); + } + } }; diff --git a/src/common-components/textbox-question/textbox-question.vue b/src/common-components/textbox-question/textbox-question.vue index 18f2851c5..4a4298f91 100644 --- a/src/common-components/textbox-question/textbox-question.vue +++ b/src/common-components/textbox-question/textbox-question.vue @@ -14,15 +14,19 @@ :aria-required="isRequired" autocomplete="off" :class="[hasIcon ? 'has-icon' : '', iconRight ? 'icon-right' : '']" - :validationRules="validationRules" /> -

- There has been an error! -

+ :validationRules="validationRules" + @input="handleChange" + @blur="handleBlur" /> +
+ {{ errorMessage }} +
diff --git a/src/constants/error-messages.js b/src/constants/error-messages.js index 1fd2a77c2..2b3382dc9 100644 --- a/src/constants/error-messages.js +++ b/src/constants/error-messages.js @@ -14,6 +14,7 @@ const errorMessages = { FIRST_NAME_REQUIRED: "Please enter your first name", LAST_NAME_REQUIRED: "Please enter your last name", EMAIL_ADDRESS_REQUIRED: "Please enter your email address", + EMAIL_ADDRESS_FORMAT: "Please enter a valid email address", }; export { errorMessages }; \ No newline at end of file diff --git a/src/helpers/validation-rules.js b/src/helpers/validation-rules.js index 1ac4ce818..9b2e14d58 100644 --- a/src/helpers/validation-rules.js +++ b/src/helpers/validation-rules.js @@ -5,4 +5,21 @@ export function required(errorMessage) { } return true; }; +} + +export function regex(expression, errorMessage) { + return (value) => { + // Field is empty, should pass + if (!value || !value.length) { + return true; + } + + // Check if email + if (!expression.test(value)) { + return errorMessage; + } + + return true; + } + } \ No newline at end of file diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue index 9914c406c..2d3cc481e 100644 --- a/src/layouts/address-lookup/address-lookup.vue +++ b/src/layouts/address-lookup/address-lookup.vue @@ -1,13 +1,21 @@ diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue index 20dae6350..b8e20d7e7 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.vue @@ -1,22 +1,22 @@