Merge pull request #1066 from Safelite/feature/CSR-1337

CSR-1337
This commit is contained in:
CarlNation 2023-04-20 10:22:08 -04:00 committed by GitHub
commit 024f2ab30e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View file

@ -101,6 +101,9 @@ describe("estimate.vue", () => {
//Arrange //Arrange
const { wrapper } = setupMocks({}); const { wrapper } = setupMocks({});
delete window.location;
window.location = { search: "?fmgPage=estimate&zipcode=43015" };
//Act //Act
estimate.beforeRouteEnter.call( estimate.beforeRouteEnter.call(
wrapper.vm, wrapper.vm,

View file

@ -149,11 +149,17 @@ export default {
const queryString = window.location.search; const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString); const urlParams = new URLSearchParams(queryString);
const hasZip = urlParams.has(queryStrings.ZIP_CODE); const lowerCaseParams = new URLSearchParams();
const zip = urlParams.get(queryStrings.ZIP_CODE); for (const [name, value] of urlParams) {
lowerCaseParams.append(name.toLowerCase(), value);
}
const zip = lowerCaseParams.get(queryStrings.ZIP_CODE)
? lowerCaseParams.get(queryStrings.ZIP_CODE)
: store.getters.order.serviceLocation.zipCode;
var vinByAddressPromise; var vinByAddressPromise;
if (hasZip) { if (zip) {
vinByAddressPromise = baseMixin.methods.dispatchStoreAction( vinByAddressPromise = baseMixin.methods.dispatchStoreAction(
storeActions.IS_VIN_BY_ADDRESS_PERMISSIBLE, storeActions.IS_VIN_BY_ADDRESS_PERMISSIBLE,
zip, zip,
@ -193,7 +199,7 @@ export default {
} }
} }
if (zip && resultMap.vinByAddress === false) { if (!zip || resultMap.vinByAddress === false) {
var indexToRemove = resultMap.cmsContent.VinLookupMethod.Answers.findIndex( var indexToRemove = resultMap.cmsContent.VinLookupMethod.Answers.findIndex(
(answer) => answer.Name === "HomeAddress" (answer) => answer.Name === "HomeAddress"
); );
@ -201,6 +207,7 @@ export default {
resultMap.cmsContent.VinLookupMethod.Answers.splice(indexToRemove, 1); resultMap.cmsContent.VinLookupMethod.Answers.splice(indexToRemove, 1);
} }
} }
vm.setCmsContent(resultMap.cmsContent); vm.setCmsContent(resultMap.cmsContent);
}); });
}, },