From 0402d8469ef46bf21808b6c392ec2c2c6c03f3e4 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Mon, 12 Dec 2022 17:14:38 -0500 Subject: [PATCH 01/17] Fixed defect CSR-934 as well as fixed other issues made apparent by the fix --- .../address-questions/address-questions.vue | 141 +++++++++++------- 1 file changed, 89 insertions(+), 52 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 74c1866f1..28df3c5e8 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 @@ -12,7 +12,8 @@ aria-haspopup="" hasIcon disableAutoFill - validationRules="street-address-required" /> + validationRules="street-address-required" + @keydown.enter.prevent /> @@ -109,6 +110,9 @@ export default { alertCopyVerificationWarning: "", alertHeadlineNoMatchWarning: "", alertCopyNoMatchWarning: "", + matchingIndirectly: false, + matchFound: false, + enterPressed: false }; }, computed: { @@ -213,11 +217,11 @@ export default { fillInAddress ); - // Wrapping the addressField1 element in the Google Address Autocomplete object - // will cause "autocomplete='off'" which Chrome completely ignores. This event - // handler will set the value to something arbitrary so autofill doesn't work. - // https://stackoverflow.com/a/30976223 addressField1.addEventListener("focus", () => { + // Wrapping the addressField1 element in the Google Address Autocomplete object + // will cause "autocomplete='off'" which Chrome completely ignores. This event + // handler will set the value to something arbitrary so autofill doesn't work. + // https://stackoverflow.com/a/30976223 addressField1.setAttribute("autocomplete", "do-not-autofill"); // Make place results box stick to the input on scroll @@ -229,27 +233,56 @@ export default { } }); + addressField1.addEventListener("keydown", (e) => { + if (e.code === "Enter" || e.code === "NumpadEnter" || e.code === "Tab") { + if (e.code === "Tab") { + self.matchingIndirectly = true; + } else { + self.enterPressed = true; + } + + addressField1.blur(); + + } else { + return; + } + }); + addressField1.addEventListener("change", () => { - const hover = document.querySelector(".pac-container .pac-item:hover"); - // if an item has been clicked, do nothing, otherwise get first solution and use Geocoder to get the place - if (hover === null) { + // NOTE: The standard "place_changed" handler of the autocomplete will use the address the user had chosen + // using either the down / up arrows or the address the user was hovering over when they pressed "Enter." + + // If there has already been a match found then do nothing + // OR + // If the user pressed "Enter" then do nothing + if (self.matchFound || self.enterPressed) { + return; + } + + // Get the address that the user clicked on (if any) + const clickedAddress = document.querySelector(".pac-container .pac-item:hover"); + + // If the Street Address field changed without clicking (by pressing Tab, or clicking outside the field) + if (clickedAddress === null) { + // Select for the user, fill-in the address using first item in the list. const item = document.querySelector(".pac-container .pac-item"); if (item != null) { + self.matchingIndirectly = true; + const firstResult = item.textContent; const geocoder = new window.google.maps.Geocoder(); - geocoder.geocode( - { - address: firstResult, + geocoder.geocode({ + address: firstResult, }, function (results, status) { if (status === window.google.maps.GeocoderStatus.OK) { - fillInAddress(results[0]); - self.displayVerificationWarning = true; + fillInAddress(results[0]); self.displayNoMatchWarning = false; } } ); } else { + // If there are no addresses found for the input then display empty address fields and warnings self.addressModel.city = ""; self.addressModel.state = ""; self.addressModel.zipCode = ""; @@ -258,6 +291,7 @@ export default { self.displayNoMatchWarning = true; } } + }); function fillInAddress(place) { @@ -266,50 +300,55 @@ export default { } if (place && place.address_components) { + self.matchFound = true; self.addressModel.streetAddress = ""; - self.showAddressFields = true; + self.$nextTick(function () { + self.showAddressFields = true; - for (const component of place.address_components) { - const componentType = component.types[0]; + for (const component of place.address_components) { + const componentType = component.types[0]; - switch (componentType) { - case "street_number": { - self.addressModel.streetAddress = component.long_name; - break; - } - case "route": { - self.addressModel.streetAddress += - " " + component.short_name; - break; - } - case "locality": { - self.addressModel.city = component.long_name; - break; - } - case "administrative_area_level_1": { - self.addressModel.state = component.short_name; - break; - } - case "postal_code": { - self.addressModel.zipCode = component.long_name; - break; + switch (componentType) { + case "street_number": { + self.addressModel.streetAddress = component.long_name; + break; + } + case "route": { + self.addressModel.streetAddress += " " + component.short_name; + break; + } + case "locality": { + self.addressModel.city = component.long_name; + break; + } + case "administrative_area_level_1": { + self.addressModel.state = component.short_name; + break; + } + case "postal_code": { + self.addressModel.zipCode = component.long_name; + break; + } } } - } - self.displayVerificationWarning = false; - self.displayNoMatchWarning = false; + self.displayVerificationWarning = self.matchingIndirectly; + + // after showing the address fields, disable the address autocomplete + window.google.maps.event.removeListener(autocompleteListener); + window.google.maps.event.clearInstanceListeners(autocomplete); + addressField1.onchange = null; + const pacContainer = document.querySelector(".pac-container"); + if (pacContainer) { + pacContainer.remove(); + } + + }); } else { self.displayVerificationWarning = true; self.displayNoMatchWarning = false; } - // after showing the address fields, disable the address autocomplete - window.google.maps.event.removeListener(autocompleteListener); - window.google.maps.event.clearInstanceListeners(autocomplete); - addressField1.onchange = null; - const pacContainer = document.querySelector(".pac-container"); - pacContainer.remove(); } }) .catch(() => { @@ -322,15 +361,13 @@ export default { this.setupAddressLookup(); }, watch: { - addressModel: { + matchFound: { handler(newValue) { - // Clear no match warning on address change - if (newValue.city || newValue.state || newValue.zipCode) { + if (newValue) { this.displayNoMatchWarning = false; } - }, - deep: true, - }, + }, + } }, components: { textboxQuestion, From 1a61604aab1e3583ced229818f38f3241d73c182 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 13 Dec 2022 07:55:51 -0500 Subject: [PATCH 02/17] Just some improved comments --- .../address-questions/address-questions.vue | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 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 28df3c5e8..37bbccb5a 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 @@ -112,7 +112,7 @@ export default { alertCopyNoMatchWarning: "", matchingIndirectly: false, matchFound: false, - enterPressed: false + enterPressed: false, }; }, computed: { @@ -234,49 +234,51 @@ export default { }); addressField1.addEventListener("keydown", (e) => { - if (e.code === "Enter" || e.code === "NumpadEnter" || e.code === "Tab") { + if (e.code === "Enter" || e.code === "NumpadEnter" || e.code === "Tab") { if (e.code === "Tab") { self.matchingIndirectly = true; } else { self.enterPressed = true; } - - addressField1.blur(); + addressField1.blur(); } else { return; } }); addressField1.addEventListener("change", () => { - // NOTE: The standard "place_changed" handler of the autocomplete will use the address the user had chosen + // NOTE: The "place_changed" event of the autocomplete fires after this and will use eitherthe address the user had chosen // using either the down / up arrows or the address the user was hovering over when they pressed "Enter." - // If there has already been a match found then do nothing + // If a match has been previously found then do nothing // OR - // If the user pressed "Enter" then do nothing + // If the user pressed "Enter" then do nothing if (self.matchFound || self.enterPressed) { return; } // Get the address that the user clicked on (if any) - const clickedAddress = document.querySelector(".pac-container .pac-item:hover"); + const clickedAddress = document.querySelector( + ".pac-container .pac-item:hover" + ); - // If the Street Address field changed without clicking (by pressing Tab, or clicking outside the field) + // If the Street Address field changed without clicking (i.e. by pressing Tab, or clicking outside the field) if (clickedAddress === null) { - // Select for the user, fill-in the address using first item in the list. + // Fill-in the address using first item in the list. const item = document.querySelector(".pac-container .pac-item"); if (item != null) { self.matchingIndirectly = true; const firstResult = item.textContent; const geocoder = new window.google.maps.Geocoder(); - geocoder.geocode({ - address: firstResult, + geocoder.geocode( + { + address: firstResult, }, function (results, status) { if (status === window.google.maps.GeocoderStatus.OK) { - fillInAddress(results[0]); + fillInAddress(results[0]); self.displayNoMatchWarning = false; } } @@ -291,14 +293,13 @@ export default { self.displayNoMatchWarning = true; } } - }); function fillInAddress(place) { if (!place) { place = autocomplete.getPlace(); } - + if (place && place.address_components) { self.matchFound = true; self.addressModel.streetAddress = ""; @@ -314,7 +315,8 @@ export default { break; } case "route": { - self.addressModel.streetAddress += " " + component.short_name; + self.addressModel.streetAddress += + " " + component.short_name; break; } case "locality": { @@ -333,7 +335,7 @@ export default { } self.displayVerificationWarning = self.matchingIndirectly; - + // after showing the address fields, disable the address autocomplete window.google.maps.event.removeListener(autocompleteListener); window.google.maps.event.clearInstanceListeners(autocomplete); @@ -342,13 +344,11 @@ export default { if (pacContainer) { pacContainer.remove(); } - }); } else { self.displayVerificationWarning = true; self.displayNoMatchWarning = false; } - } }) .catch(() => { @@ -366,8 +366,8 @@ export default { if (newValue) { this.displayNoMatchWarning = false; } - }, - } + }, + }, }, components: { textboxQuestion, From 2bc14c5a313766d9288b638fc8d4f4329ea5fb24 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 13 Dec 2022 16:27:43 -0500 Subject: [PATCH 03/17] Added programmatic watch for address model when an address is not found --- .../address-questions/address-questions.vue | 36 +++++++++++++------ 1 file changed, 25 insertions(+), 11 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 37bbccb5a..56f346ca2 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 @@ -111,8 +111,9 @@ export default { alertHeadlineNoMatchWarning: "", alertCopyNoMatchWarning: "", matchingIndirectly: false, - matchFound: false, + matchFound: null, // null = no attempted match, true = match was found, false = match was not found enterPressed: false, + unwatchAddress: null // handle to allow us to only deep watch the address model when a match was not found }; }, computed: { @@ -262,7 +263,7 @@ export default { const clickedAddress = document.querySelector( ".pac-container .pac-item:hover" ); - + // If the Street Address field changed without clicking (i.e. by pressing Tab, or clicking outside the field) if (clickedAddress === null) { // Fill-in the address using first item in the list. @@ -284,13 +285,8 @@ export default { } ); } else { - // If there are no addresses found for the input then display empty address fields and warnings - self.addressModel.city = ""; - self.addressModel.state = ""; - self.addressModel.zipCode = ""; - self.showAddressFields = true; - self.displayVerificationWarning = false; - self.displayNoMatchWarning = true; + // No addresses found for the input + self.matchFound = false; } } }); @@ -299,7 +295,7 @@ export default { if (!place) { place = autocomplete.getPlace(); } - + if (place && place.address_components) { self.matchFound = true; self.addressModel.streetAddress = ""; @@ -363,9 +359,27 @@ export default { watch: { matchFound: { handler(newValue) { - if (newValue) { + if (newValue === null) { this.displayNoMatchWarning = false; + this.unwatchAddress(); + return; } + + if (!newValue) { + this.displayNoMatchWarning = true; + + this.addressModel.city = ""; + this.addressModel.state = ""; + this.addressModel.zipCode = ""; + this.showAddressFields = true; + this.displayVerificationWarning = false; + + // Only deep watch the Address Model after a failed match + this.unwatchAddress = this.$watch("addressModel", (newAddress) => { + // When the address model changes reset to "no attempted match" + this.matchFound = null; + }, { deep: true }); + } }, }, }, From 69e739622a9397ee6db8a2d7ce4d6fab3e045747 Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 19 Dec 2022 16:26:35 -0500 Subject: [PATCH 04/17] CSR-747 Add navigation logic for estimate for 6-digit referral numbers --- src/layouts/estimate/estimate.vue | 5 ++++- src/layouts/quote/quote.vue | 3 ++- src/mixins/vehicle-questions-mixin.js | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index e2e3cbb07..aeb80bb35 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -219,7 +219,10 @@ export default { payment.isInsurance && payment.insuranceCoverage.coverageStatus; if (vehicleChangedDuringPolicyLookupInHeritage) { navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); - } else if (this.isRepair) { + } else if (this.$store.getters.order.referralNumber.length === 6) { + await this.navigateForwardWithSingleCarMatch(); + } + else if (this.isRepair) { return this.$router.navigateWithSaving( this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS, this.$route diff --git a/src/layouts/quote/quote.vue b/src/layouts/quote/quote.vue index 5eababde5..4cb2dcf55 100644 --- a/src/layouts/quote/quote.vue +++ b/src/layouts/quote/quote.vue @@ -144,7 +144,8 @@ export default { store.getters.order.serviceLocation.zipCodeCtu && (store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && - store.getters.order.lineItems.glassParts.length > 0)) + store.getters.order.lineItems.glassParts.length > 0)) && + store.getters.order.referralNumber?.length !== 6 ); }, getDefaultIsInsuranceSelectedValue(availableLineItems) { diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 49f291392..a390309b3 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -446,7 +446,10 @@ export default { const payment = store.getters.payment; - if (payment.isInsurance && payment.insuranceCoverage.isVerified) { + if (store.getters.order.referralNumber?.length === 6) { + navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); + } + else if (payment.isInsurance && payment.insuranceCoverage.isVerified) { navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); } else { self.$router.navigateWithSaving( From 3f87f75be277221ba4b6933dd5af2fe61f0db13e Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Tue, 20 Dec 2022 08:00:07 -0500 Subject: [PATCH 05/17] Fix for CSR-934, includes several improvements and fixes for undocumented defects. --- .../address-questions.spec.js | 193 ++++++------------ .../address-questions/address-questions.vue | 34 +-- 2 files changed, 79 insertions(+), 148 deletions(-) diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js index 4a8e87feb..439e2922c 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js @@ -5,7 +5,6 @@ import alert from "@/ux-components/alert/alert"; // Supporting Files import { mount, shallowMount } from "@vue/test-utils"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; -import { storeActions } from "@/constants/store-actions"; import { storeMutations } from "@/constants/store-mutations"; import store from "@/store"; @@ -59,35 +58,6 @@ describe("address-questions.vue", () => { expect(zipCode.exists()).toBe(true); }); - test("Should set this.displayNoMatchWarning to false when it is set to true, if the model if prepopulated", async () => { - // Arrange - const newAddressModel = { - streetAddress: "foo", - city: "foo", - state: "foo", - zipCode: "55555", - }; - const wrapper = shallowMount(addressQuestions, { - propsData: { - modelValue: newAddressModel, - }, - }); - - await wrapper.setData({ - displayNoMatchWarning: true, - }); - expect(wrapper.vm.displayNoMatchWarning).toBeTruthy(); - - // Act - wrapper.vm.$options.watch.addressModel.handler.call( - wrapper.vm, - wrapper.vm.addressModel - ); - - // Assert - expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); - }); - test("Should it set this.showAddressFields to true when the model is prepopulated", async () => { // Arrange // Act @@ -239,81 +209,13 @@ describe("address-questions.vue", () => { ); // Assert - const addressModel = wrapper.vm.addressModel; - expect(addressModel.streetAddress).toEqual("1234 Test Road"); - expect(addressModel.city).toEqual("Columbus"); - expect(addressModel.state).toEqual("OH"); - expect(addressModel.zipCode).toEqual("43215"); - }); - - test("street address is entered, user chooses good result from autocomplete results => alerts are cleared", async () => { - // Arrange - const { wrapper } = setupMocks({}); - await wrapper.setData({ - addressModel: { - streetAddress: "123 Test Street", - }, - displayVerificationWarning: true, - displayNoMatchWarning: true, + wrapper.vm.$nextTick(function () { + const addressModel = wrapper.vm.addressModel; + expect(addressModel.streetAddress).toEqual("1234 Test Road"); + expect(addressModel.city).toEqual("Columbus"); + expect(addressModel.state).toEqual("OH"); + expect(addressModel.zipCode).toEqual("43215"); }); - - let alerts = wrapper.findAllComponents(alert); - alerts.forEach((alert) => expect(alert.isVisible()).toBeTruthy()); - - const selectedPlace = { - address_components: [ - { - long_name: "1234", - short_name: "1234", - types: ["street_number"], - }, - { - long_name: "Test Road", - short_name: "Test Road", - types: ["route"], - }, - { - long_name: "East Columbus", - short_name: "Columbus", - types: ["neighborhood", "political"], - }, - { - long_name: "Columbus", - short_name: "Columbus", - types: ["locality", "political"], - }, - { - long_name: "Franklin County", - short_name: "Franklin County", - types: ["administrative_area_level_2", "political"], - }, - { - long_name: "Ohio", - short_name: "OH", - types: ["administrative_area_level_1", "political"], - }, - { - long_name: "United States", - short_name: "US", - types: ["country", "political"], - }, - { - long_name: "43215", - short_name: "43215", - types: ["postal_code"], - }, - ], - }; - - // Act - autocompleteElement.dispatchEvent( - new CustomEvent("place_changed", { detail: selectedPlace }) - ); - await wrapper.vm.$nextTick(); - - // Assert - alerts = wrapper.findAllComponents(alert); - alerts.forEach((alert) => expect(alert.exists()).toBeFalsy()); }); test("street address is entered, but user clicks away => first result is selected and other fields are filled in", async () => { @@ -413,13 +315,8 @@ describe("address-questions.vue", () => { addressModel: { streetAddress: "123 Test Street", }, - displayVerificationWarning: true, - displayNoMatchWarning: true, }); - let alerts = wrapper.findAllComponents(alert); - alerts.forEach((alert) => expect(alert.isVisible()).toBeTruthy()); - const selectedPlace = place; // Act @@ -434,6 +331,7 @@ describe("address-questions.vue", () => { }); expect(verificationAlert.exists()).toBe(true); expect(verificationAlert.isVisible()).toBe(true); + const noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); expect(noMatchAlert.exists()).toBe(false); } @@ -513,12 +411,12 @@ describe("address-questions.vue", () => { }); describe("noMatch alert is cleared on address change", () => { - test("user sees noMatch warning and enters city => noMatch warning is removed", async () => { + test("user sees noMatch warning and modifies street address => noMatch warning is removed", async () => { // Arrange const { wrapper } = setupMocks({}); - wrapper.setData({ - displayNoMatchWarning: true, + await wrapper.setData({ + matchFound: false, }); await wrapper.vm.$nextTick(); @@ -526,24 +424,53 @@ describe("address-questions.vue", () => { expect(noMatchAlert.exists()).toBeTruthy(); expect(noMatchAlert.isVisible()).toBeTruthy(); - // Act + // // Act wrapper.vm.$options.watch.addressModel.handler.call(wrapper.vm, { - city: "Somewhere", + streetAddress: "LS", + }); + + // Assert + wrapper.vm.$nextTick(function () { + expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); + + noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); + expect(noMatchAlert.exists()).toBeFalsy(); + }); + }); + + test("user sees noMatch warning and enters city => noMatch warning is removed", async () => { + // Arrange + const { wrapper } = setupMocks({}); + + await wrapper.setData({ + matchFound: false, }); await wrapper.vm.$nextTick(); + let noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); + expect(noMatchAlert.exists()).toBeTruthy(); + expect(noMatchAlert.isVisible()).toBeTruthy(); + + // // Act + wrapper.vm.$options.watch.addressModel.handler.call(wrapper.vm, { + city: "LS", + }); + // Assert - expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); - noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); - expect(noMatchAlert.exists()).toBeFalsy(); + wrapper.vm.$nextTick(function () { + expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); + + noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); + expect(noMatchAlert.exists()).toBeFalsy(); + }); }); test("user sees noMatch warning and enters state => noMatch warning is removed", async () => { // Arrange const { wrapper } = setupMocks({}); - wrapper.setData({ - displayNoMatchWarning: true, + await wrapper.setData({ + matchFound: false, }); await wrapper.vm.$nextTick(); @@ -551,24 +478,26 @@ describe("address-questions.vue", () => { expect(noMatchAlert.exists()).toBeTruthy(); expect(noMatchAlert.isVisible()).toBeTruthy(); - // Act + // // Act wrapper.vm.$options.watch.addressModel.handler.call(wrapper.vm, { state: "KO", }); - await wrapper.vm.$nextTick(); // Assert - expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); - noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); - expect(noMatchAlert.exists()).toBeFalsy(); + wrapper.vm.$nextTick(function () { + expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); + + noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); + expect(noMatchAlert.exists()).toBeFalsy(); + }); }); test("user sees noMatch warning and enters zip code => noMatch warning is removed", async () => { // Arrange const { wrapper } = setupMocks({}); - wrapper.setData({ - displayNoMatchWarning: true, + await wrapper.setData({ + matchFound: false, }); await wrapper.vm.$nextTick(); @@ -576,16 +505,18 @@ describe("address-questions.vue", () => { expect(noMatchAlert.exists()).toBeTruthy(); expect(noMatchAlert.isVisible()).toBeTruthy(); - // Act + // // Act wrapper.vm.$options.watch.addressModel.handler.call(wrapper.vm, { zipCode: "12345", }); - await wrapper.vm.$nextTick(); // Assert - expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); - noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); - expect(noMatchAlert.exists()).toBeFalsy(); + wrapper.vm.$nextTick(function () { + expect(wrapper.vm.displayNoMatchWarning).toBeFalsy(); + + noMatchAlert = wrapper.findComponent({ ref: "alertNoMatchWarning" }); + expect(noMatchAlert.exists()).toBeFalsy(); + }); }); }); }); 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 56f346ca2..4ad515fbb 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 @@ -113,7 +113,7 @@ export default { matchingIndirectly: false, matchFound: null, // null = no attempted match, true = match was found, false = match was not found enterPressed: false, - unwatchAddress: null // handle to allow us to only deep watch the address model when a match was not found + isAddressWatchActive: false, // Only deep watch the address model when a match was not found }; }, computed: { @@ -249,7 +249,7 @@ export default { }); addressField1.addEventListener("change", () => { - // NOTE: The "place_changed" event of the autocomplete fires after this and will use eitherthe address the user had chosen + // NOTE: The "place_changed" event of the autocomplete fires after this and will use either the address the user had chosen // using either the down / up arrows or the address the user was hovering over when they pressed "Enter." // If a match has been previously found then do nothing @@ -280,7 +280,6 @@ export default { function (results, status) { if (status === window.google.maps.GeocoderStatus.OK) { fillInAddress(results[0]); - self.displayNoMatchWarning = false; } } ); @@ -343,7 +342,6 @@ export default { }); } else { self.displayVerificationWarning = true; - self.displayNoMatchWarning = false; } } }) @@ -359,12 +357,6 @@ export default { watch: { matchFound: { handler(newValue) { - if (newValue === null) { - this.displayNoMatchWarning = false; - this.unwatchAddress(); - return; - } - if (!newValue) { this.displayNoMatchWarning = true; @@ -373,15 +365,23 @@ export default { this.addressModel.zipCode = ""; this.showAddressFields = true; this.displayVerificationWarning = false; - - // Only deep watch the Address Model after a failed match - this.unwatchAddress = this.$watch("addressModel", (newAddress) => { - // When the address model changes reset to "no attempted match" - this.matchFound = null; - }, { deep: true }); - } + + this.$nextTick(function () { + // Only deep watch the Address Model after a failed match + this.isAddressWatchActive = true; + }); + } }, }, + addressModel: { + handler() { + if (this.isAddressWatchActive) { + this.displayNoMatchWarning = false; + this.isAddressWatchActive = false; + } + }, + deep: true, + }, }, components: { textboxQuestion, From 36e2b3c6f1c04d9029b8f3df44c4ae4c7f480e2b Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Tue, 20 Dec 2022 11:27:07 -0500 Subject: [PATCH 06/17] CSR-938: fix vehicle-parts back button --- src/layouts/vehicle-parts/vehicle-parts.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/layouts/vehicle-parts/vehicle-parts.vue b/src/layouts/vehicle-parts/vehicle-parts.vue index c2acb6ca0..1c35f96fa 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.vue +++ b/src/layouts/vehicle-parts/vehicle-parts.vue @@ -35,7 +35,7 @@ cmsWidgetName="FunnelFooterWidget" ref="funnelFooter" :isForwardActionDisabled="isForwardActionDisabled" - @back-click="navigateBack" + @back-clicked="navigateBack" @ForwardClicked="forwardButtonAction" /> From ded8032cd05cf050d83f2291516febfa64041845 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 20 Dec 2022 12:59:54 -0500 Subject: [PATCH 07/17] CSR-747 Fix estimate bug --- src/layouts/estimate/estimate.vue | 5 ++--- src/mixins/vehicle-questions-mixin.js | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index aeb80bb35..9387bd89a 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -219,10 +219,9 @@ export default { payment.isInsurance && payment.insuranceCoverage.coverageStatus; if (vehicleChangedDuringPolicyLookupInHeritage) { navigateToHeritageFunnel({ loadingModal: this.$refs.loadingModal }); - } else if (this.$store.getters.order.referralNumber.length === 6) { + } else if (this.$store.getters.order.referralNumber?.length === 6) { await this.navigateForwardWithSingleCarMatch(); - } - else if (this.isRepair) { + } else if (this.isRepair) { return this.$router.navigateWithSaving( this.navigationScenarios.CLICKED_FORWARD_WITH_NO_QUESTIONS, this.$route diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index a390309b3..3a8fd4657 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -448,8 +448,7 @@ export default { if (store.getters.order.referralNumber?.length === 6) { navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); - } - else if (payment.isInsurance && payment.insuranceCoverage.isVerified) { + } else if (payment.isInsurance && payment.insuranceCoverage.isVerified) { navigateToHeritageFunnel({ loadingModal: self.$refs.loadingModal }); } else { self.$router.navigateWithSaving( From 701b42ac60f5caa82f354247390f118dd608dd02 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 20 Dec 2022 13:15:34 -0500 Subject: [PATCH 08/17] CSR-747 Tests and formatting --- src/layouts/capability-questions/capability-questions.spec.js | 1 + src/layouts/molding-questions/molding-questions.spec.js | 2 ++ src/layouts/part-questions/part-questions.spec.js | 3 +++ src/layouts/vehicle-parts/vehicle-parts.spec.js | 1 + 4 files changed, 7 insertions(+) diff --git a/src/layouts/capability-questions/capability-questions.spec.js b/src/layouts/capability-questions/capability-questions.spec.js index f29be44e6..34fb4be05 100644 --- a/src/layouts/capability-questions/capability-questions.spec.js +++ b/src/layouts/capability-questions/capability-questions.spec.js @@ -113,6 +113,7 @@ afterEach(() => { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, payment: { insuranceCoverage: {} }, + order: {}, }; }); diff --git a/src/layouts/molding-questions/molding-questions.spec.js b/src/layouts/molding-questions/molding-questions.spec.js index a97e14b41..13961df5a 100644 --- a/src/layouts/molding-questions/molding-questions.spec.js +++ b/src/layouts/molding-questions/molding-questions.spec.js @@ -107,6 +107,7 @@ const baseStoreGettersDamage = () => { store.getters = { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, + order: {}, }; store.commit = jest.fn(); @@ -116,6 +117,7 @@ afterEach(() => { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, payment: { insuranceCoverage: {} }, + order: {}, }; }); diff --git a/src/layouts/part-questions/part-questions.spec.js b/src/layouts/part-questions/part-questions.spec.js index 8de000009..3382ec1dc 100644 --- a/src/layouts/part-questions/part-questions.spec.js +++ b/src/layouts/part-questions/part-questions.spec.js @@ -97,6 +97,7 @@ const baseStoreGettersDamage = () => { store.getters = { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, + order: {}, }; store.commit = jest.fn(); @@ -140,6 +141,7 @@ describe("partQuestions.vue...", () => { }; }), damage: baseStoreGettersDamage, + order: {}, }; const { wrapper } = setupMocks({}); @@ -159,6 +161,7 @@ describe("partQuestions.vue...", () => { store.getters = { pageData: baseStoreGettersPageData, damage: baseStoreGettersDamage, + order: {}, }; const { wrapper } = setupMocks({}); const spy = jest.spyOn(wrapper.vm, "handleCompletedQuestionChainAnswers"); diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js index d14491ccd..23ce3b88a 100644 --- a/src/layouts/vehicle-parts/vehicle-parts.spec.js +++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js @@ -460,6 +460,7 @@ describe("vehicle-parts.vue", () => { store.getters.lineItems = { glassParts: {} }; store.getters.vehicle = { carId: "TEST_CAR_ID" }; store.getters.payment = { insuranceCoverage: {} }; + store.getters.order = {}; const { wrapper } = setupMocks({ mountOptionsMockData: { From 54141b32725c53cfd0f947d67bd363b76bac2f89 Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 21 Dec 2022 07:35:27 -0500 Subject: [PATCH 09/17] Removed 'disabledAutofill' prop from dropdown-question to match textbox-question and prevent the State label from being read incorrectly by JAWS --- src/common-components/dropdown-question/dropdown-question.vue | 1 - .../address-questions/address-questions.spec.js | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/common-components/dropdown-question/dropdown-question.vue b/src/common-components/dropdown-question/dropdown-question.vue index 4567994f1..e7c183e49 100644 --- a/src/common-components/dropdown-question/dropdown-question.vue +++ b/src/common-components/dropdown-question/dropdown-question.vue @@ -38,7 +38,6 @@ export default { }, isDisabled: Boolean, isRequired: Boolean, - disableAutoFill: Boolean, validationRules: String, cmsWidgetName: String, hasError: Boolean, diff --git a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js index 439e2922c..c8d24c57e 100644 --- a/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js +++ b/src/layouts/address-lookup/customer-questions/address-questions/address-questions.spec.js @@ -128,7 +128,7 @@ describe("address-questions.vue", () => { expect(wrapper.vm.$loadScript).not.toHaveBeenCalled(); }); - test("address field is focused => disable autocomplete", async () => { + test("address field is focused => disable autofill", async () => { // Arrange let focusEventCallbackFunction; autocompleteElement.addEventListener = jest From 571fad279bdc01c17997e41d99f4b8877959dd9b Mon Sep 17 00:00:00 2001 From: Leah Schumann Date: Wed, 21 Dec 2022 07:52:38 -0500 Subject: [PATCH 10/17] Removed test for inserting ⁠ into the visual label --- .../dropdown-question.spec.js | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/src/common-components/dropdown-question/dropdown-question.spec.js b/src/common-components/dropdown-question/dropdown-question.spec.js index 249b00710..20bba1712 100644 --- a/src/common-components/dropdown-question/dropdown-question.spec.js +++ b/src/common-components/dropdown-question/dropdown-question.spec.js @@ -48,29 +48,6 @@ describe("dropdownQuestion.vue", () => { expect(label.text()).toContain(questionText); }); - it("Should render the 'questionText' data value with '⁠' after the first character of each word in the label text when disableAutoFill is true.", async () => { - // Arrange - const wrapper = shallowMount(dropdownQuestion, { - propsData: { - options: {}, - disableAutoFill: true, - }, - mixins: [mockMixin], - }); - - // Mock CMS content ... - // Trust me, the below instance of the string "Q⁠uestion Text" actually has the ⁠ in it. You just can't see it - // Don't believe me? Copy and paste it into Google. Then inspect the search field element in Dev Tools, - // you will see "Q⁠uestion T⁠ext" - const expectedQuestionText = "Q⁠uestion T⁠ext"; - - // Act - const label = wrapper.find("label"); - - // Assert - expect(label.text()).toContain(expectedQuestionText); - }); - it("Should return input id as the id of the select field", async () => { // Arrange const wrapper = shallowMount(dropdownQuestion, { From 55c67333bc742dbca96b150dc81372958bd9ada6 Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 21 Dec 2022 11:22:29 -0500 Subject: [PATCH 11/17] CSR-803 ish: added unit tests / cleaned up some unit tests --- .../button-question/button-question.spec.js | 8 --- .../dropdown-question.spec.js | 2 - .../button-main/button-main.spec.js | 52 +++++++------------ src/ux-components/loader/loader.spec.js | 33 +++++++++++- 4 files changed, 52 insertions(+), 43 deletions(-) diff --git a/src/common-components/button-question/button-question.spec.js b/src/common-components/button-question/button-question.spec.js index 132e5edb9..eb2308ca0 100644 --- a/src/common-components/button-question/button-question.spec.js +++ b/src/common-components/button-question/button-question.spec.js @@ -2,14 +2,6 @@ import { shallowMount, mount } from "@vue/test-utils"; import buttonQuestion from "@/common-components/button-question/button-question"; import { getMountOptions } from "@/helpers/unit-test-helper.js"; -jest.mock( - "@/store", - () => { - return {}; - }, - { virtual: true } -); - describe("buttonQuestion.vue", () => { it("Should show overflow classes on fieldset if isOverflowScrollable is true", () => { // Act diff --git a/src/common-components/dropdown-question/dropdown-question.spec.js b/src/common-components/dropdown-question/dropdown-question.spec.js index 20bba1712..a606e3d19 100644 --- a/src/common-components/dropdown-question/dropdown-question.spec.js +++ b/src/common-components/dropdown-question/dropdown-question.spec.js @@ -23,8 +23,6 @@ describe("dropdownQuestion.vue", () => { mixins: [mockMixin], }); - wrapper.getCmsContent = jest.fn(); - // Act const select = wrapper.find("select"); diff --git a/src/ux-components/button-main/button-main.spec.js b/src/ux-components/button-main/button-main.spec.js index 816a83e55..cd434cfec 100644 --- a/src/ux-components/button-main/button-main.spec.js +++ b/src/ux-components/button-main/button-main.spec.js @@ -4,89 +4,77 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js"; import { nextTick } from "vue"; describe("buttonMain.vue", () => { - it("Should return btn-primary class", async () => { - // Act + it("Should return btn-primary class", () => { + // Arrange/Act const wrapper = shallowMount( buttonMain, setupMocks({ - propsData: { + props: { isPrimary: true, }, }) ); - - // Assert const button = wrapper.find("button"); - - // Expect + + // Assert expect(button.attributes("class")).toContain("btn-primary"); }); - it("Should return aria-disabled state", async () => { - // Act + it("Should return aria-disabled state", () => { + // Arrange/Act const wrapper = shallowMount( buttonMain, setupMocks({ - propsData: { + props: { isDisabled: true, }, }) ); - - // Assert const button = wrapper.find("button"); - // Expect + // Assert expect(button.attributes()["aria-disabled"]).toEqual("true"); }); it("Should return loader color", async () => { - // Act + // Arrange const wrapper = shallowMount( buttonMain, setupMocks({ - propsData: { + props: { loaderColor: "blue", loaderEnabled: true, }, }) ); - // Assert - - const label = wrapper.find("label"); - + // Act wrapper.vm.clicked(); - await nextTick(); - + + // Assert const loader = wrapper.find("loader-stub"); - expect(loader.attributes("class")).toContain("blue"); }); it("Should return loader position", async () => { - // Act + // Arrange const wrapper = shallowMount( buttonMain, setupMocks({ - propsData: { + props: { loaderPosition: "right", loaderEnabled: true, }, }) ); - - // Assert - - const label = wrapper.find("label"); - + + // Act wrapper.vm.clicked(); - await nextTick(); - + + // Assert const loader = wrapper.find("loader-stub"); - expect(loader.attributes("class")).toContain("right"); }); }); diff --git a/src/ux-components/loader/loader.spec.js b/src/ux-components/loader/loader.spec.js index 3d0843e10..43b613e6b 100644 --- a/src/ux-components/loader/loader.spec.js +++ b/src/ux-components/loader/loader.spec.js @@ -1 +1,32 @@ -test.todo("some test to be written in the future"); +import { shallowMount, mount } from "@vue/test-utils"; +import loader from "./loader"; + +describe("loader.vue", () => { + test("if it rendered the HTML element with class", () => { + // Arrange/Act + const wrapper = shallowMount(loader, { + props: {}, + }); + + // Assert + expect(wrapper.find('div').exists()).toBeTruthy(); + expect(wrapper.find('.loader').exists()).toBeTruthy(); + }); + + test("if it correctly passed props", () => { + // Arrange/Act + const wrapper = shallowMount(loader, { + props: { + loaderColor: "blue", + loaderPosition: "left" + }, + }); + + // Assert + expect(wrapper.props()).toMatchObject({ + loaderColor: "blue", + loaderPosition: "left", + }); + }); + +}); \ No newline at end of file From a93c1c67407d02ea26907a01bca53f4b9f5d394b Mon Sep 17 00:00:00 2001 From: Adam Caouette Date: Wed, 21 Dec 2022 11:24:49 -0500 Subject: [PATCH 12/17] CSR-803 ish: prettier formatting updates --- src/ux-components/button-main/button-main.spec.js | 8 ++++---- src/ux-components/loader/loader.spec.js | 9 ++++----- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/ux-components/button-main/button-main.spec.js b/src/ux-components/button-main/button-main.spec.js index cd434cfec..b7fe7df09 100644 --- a/src/ux-components/button-main/button-main.spec.js +++ b/src/ux-components/button-main/button-main.spec.js @@ -15,7 +15,7 @@ describe("buttonMain.vue", () => { }) ); const button = wrapper.find("button"); - + // Assert expect(button.attributes("class")).toContain("btn-primary"); }); @@ -51,7 +51,7 @@ describe("buttonMain.vue", () => { // Act wrapper.vm.clicked(); await nextTick(); - + // Assert const loader = wrapper.find("loader-stub"); expect(loader.attributes("class")).toContain("blue"); @@ -68,11 +68,11 @@ describe("buttonMain.vue", () => { }, }) ); - + // Act wrapper.vm.clicked(); await nextTick(); - + // Assert const loader = wrapper.find("loader-stub"); expect(loader.attributes("class")).toContain("right"); diff --git a/src/ux-components/loader/loader.spec.js b/src/ux-components/loader/loader.spec.js index 43b613e6b..fb1eea21e 100644 --- a/src/ux-components/loader/loader.spec.js +++ b/src/ux-components/loader/loader.spec.js @@ -9,8 +9,8 @@ describe("loader.vue", () => { }); // Assert - expect(wrapper.find('div').exists()).toBeTruthy(); - expect(wrapper.find('.loader').exists()).toBeTruthy(); + expect(wrapper.find("div").exists()).toBeTruthy(); + expect(wrapper.find(".loader").exists()).toBeTruthy(); }); test("if it correctly passed props", () => { @@ -18,7 +18,7 @@ describe("loader.vue", () => { const wrapper = shallowMount(loader, { props: { loaderColor: "blue", - loaderPosition: "left" + loaderPosition: "left", }, }); @@ -28,5 +28,4 @@ describe("loader.vue", () => { loaderPosition: "left", }); }); - -}); \ No newline at end of file +}); From a9c24359c204532bf6a0924b34bd53d0c7c6c354 Mon Sep 17 00:00:00 2001 From: Katie Date: Thu, 22 Dec 2022 08:16:40 -0500 Subject: [PATCH 13/17] CSR-747 Cleanup --- src/constants/store-actions.js | 1 - src/layouts/vehicle-damage/vehicle-damage.vue | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/constants/store-actions.js b/src/constants/store-actions.js index d5780d96b..3d9307914 100644 --- a/src/constants/store-actions.js +++ b/src/constants/store-actions.js @@ -66,7 +66,6 @@ const storeActions = { "resetMoldingAndCapabilityQuestionAnswersIfNeeded", SAVE_MOLDING_QUESTION_ANSWERS: "saveMoldingQuestionAnswers", SAVE_CAPABILITY_QUESTION_ANSWERS: "saveCapabilityQuestionAnswers", - SAVE_QUOTE_PAGE_SELECTIONS: "saveQuotePageSelections", SAVE_PAYMENT_TYPE: "savePaymentType", SAVE_ACCOUNT_NUMBER: "saveAccountNumber", SAVE_SUPPORTING_ITEMS: "saveSupportingItems", diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 8ed805bf3..5b2e88abe 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -329,7 +329,7 @@ export default { navigateForward() { const payment = this.$store.getters.payment; - console.log(payment); + const vehicleChangedDuringPolicyLookupInHeritage = payment.isInsurance && payment.insuranceCoverage.coverageStatus && From 142b7b2a076e3a9074ca928268ad1fe01444eff5 Mon Sep 17 00:00:00 2001 From: Katie Date: Thu, 22 Dec 2022 09:46:05 -0500 Subject: [PATCH 14/17] CSR-747 Change referrer for local --- src/mixins/analytics-mixin.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index a4eb993de..86cd14a80 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -19,6 +19,7 @@ import { cookieNames } from "@/constants/cookie-names"; import store from "@/store"; import baseMixin from "@/mixins/base-mixin"; +import { applicationConfig } from "../constants/application-config"; export default { methods: { @@ -129,11 +130,13 @@ export default { async initSession() { const sid = getSessionIdValue(); const skey = getSessionKeyValue(); + const referrer = applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null; + var payload = { userId: getDeviceIdValue(), sessionId: sid, userAgent: navigator.userAgent, - referrer: document.referrer, + referrer: referrer, }; const response = await baseMixin.methods.dispatchStoreAction( From 0fb2104f97df89df5872bacbd973e04a719381af Mon Sep 17 00:00:00 2001 From: Katie Date: Thu, 22 Dec 2022 10:56:41 -0500 Subject: [PATCH 15/17] CSR-747 Fix /initialize issue for local --- src/layouts/vehicle-damage/vehicle-damage.vue | 2 +- src/mixins/analytics-mixin.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue index 5b2e88abe..7446d4cd0 100644 --- a/src/layouts/vehicle-damage/vehicle-damage.vue +++ b/src/layouts/vehicle-damage/vehicle-damage.vue @@ -329,7 +329,7 @@ export default { navigateForward() { const payment = this.$store.getters.payment; - + const vehicleChangedDuringPolicyLookupInHeritage = payment.isInsurance && payment.insuranceCoverage.coverageStatus && diff --git a/src/mixins/analytics-mixin.js b/src/mixins/analytics-mixin.js index 86cd14a80..3fbc9501d 100644 --- a/src/mixins/analytics-mixin.js +++ b/src/mixins/analytics-mixin.js @@ -130,8 +130,9 @@ export default { async initSession() { const sid = getSessionIdValue(); const skey = getSessionKeyValue(); - const referrer = applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null; - + const referrer = + applicationConfig.CURRENT_ENVIRONMENT != "Localhost" ? document.referrer : null; + var payload = { userId: getDeviceIdValue(), sessionId: sid, From e2998b997ea149352dcb2818aaf2588be6d2ab2d Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 27 Dec 2022 08:56:10 -0500 Subject: [PATCH 16/17] CSR-1002 Fix back issue on quote for repair --- src/mixins/vehicle-questions-mixin.js | 10 +++++----- .../router-constants/navigation-scenarios.js | 1 - src/router/router-constants/routing-table.js | 16 ---------------- 3 files changed, 5 insertions(+), 22 deletions(-) diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index 3a8fd4657..b28bf647f 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -498,9 +498,11 @@ export default { const hasCapabilityQuestions = this.hasCapabilityQuestions(currentPartsOrQuestions); const skipVinLookup = await store.dispatch(storeActions.IS_VIN_OPTIONAL_VEHICLE); - let backNavigationScenario = self.$store.getters.vehicle.vin - ? navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS - : navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS; + const vin = self.$store.getters.vehicle.vin; + let backNavigationScenario = + !vin || vin !== "" || skipVinLookup + ? navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS + : navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS; if ( hasCapabilityQuestions && @@ -523,8 +525,6 @@ export default { this.currentPageComesAfterPage(currentPage, fmgPageValues.PART_QUESTIONS) ) { backNavigationScenario = navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS; - } else if (skipVinLookup) { - backNavigationScenario = navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE; } self.$router.navigateWithoutSaving(backNavigationScenario, self.$route); diff --git a/src/router/router-constants/navigation-scenarios.js b/src/router/router-constants/navigation-scenarios.js index a29678b28..cea67f73a 100644 --- a/src/router/router-constants/navigation-scenarios.js +++ b/src/router/router-constants/navigation-scenarios.js @@ -44,7 +44,6 @@ const navigationScenarios = { CLICKED_BACK_WITH_CAPABILITY_QUESTIONS: "CLICKED_BACK_WITH_CAPABILITY_QUESTIONS", CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS: "CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS", CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS: "CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS", - CLICKED_BACK_TO_GO_TO_ESTIMATE: "CLICKED_BACK_TO_GO_TO_ESTIMATE", }; export { navigationScenarios }; diff --git a/src/router/router-constants/routing-table.js b/src/router/router-constants/routing-table.js index 9e086804e..5bc959d6a 100644 --- a/src/router/router-constants/routing-table.js +++ b/src/router/router-constants/routing-table.js @@ -296,10 +296,6 @@ const routingTable = function (store) { scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, - { - scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, ], }, { @@ -333,10 +329,6 @@ const routingTable = function (store) { scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, - { - scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, ], }, { @@ -366,10 +358,6 @@ const routingTable = function (store) { scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, - { - scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, ], }, { @@ -399,10 +387,6 @@ const routingTable = function (store) { scenario: navigationScenarios.CLICKED_FORWARD_WITH_NO_MORE_QUESTIONS, destinationFmgPageValue: fmgPageValues.QUOTE, }, - { - scenario: navigationScenarios.CLICKED_BACK_TO_GO_TO_ESTIMATE, - destinationFmgPageValue: fmgPageValues.ESTIMATE, - }, ], }, { From 10a16991cbc3171b6406131f174b229c422cc497 Mon Sep 17 00:00:00 2001 From: Katie Date: Tue, 27 Dec 2022 09:23:23 -0500 Subject: [PATCH 17/17] CSR-1002 Fix tests, format --- src/mixins/vehicle-questions-mixin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mixins/vehicle-questions-mixin.js b/src/mixins/vehicle-questions-mixin.js index b28bf647f..29888c9c8 100644 --- a/src/mixins/vehicle-questions-mixin.js +++ b/src/mixins/vehicle-questions-mixin.js @@ -500,7 +500,7 @@ export default { const vin = self.$store.getters.vehicle.vin; let backNavigationScenario = - !vin || vin !== "" || skipVinLookup + !vin || vin === "" || skipVinLookup ? navigationScenarios.CLICKED_BACK_WITH_NO_VIN_NOR_QUESTIONS : navigationScenarios.CLICKED_BACK_WITH_VIN_AND_NO_MORE_QUESTIONS;