Merge pull request #792 from Safelite/defect/CSR-869-2

CSR-869 Refix
This commit is contained in:
katieoh-safelite 2022-10-28 14:54:13 -04:00 committed by GitHub
commit e7e7391866
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 2 deletions

View file

@ -220,6 +220,28 @@ describe("vin-lookup.vue", () => {
expect(wrapper.vm.displayInvalidZipAlert).toEqual(true);
expect(wrapper.findComponent({ ref: "alertInvalidZip" }).exists()).toBe(true);
});
test("alerts are displayed and continue button is clicked with issues fixed => alerts are reset", async () => {
// Arrange
const { wrapper } = setupMocks({});
mockOutPromises({ isZipValid: true, isZipServiceable: true, carId: "CARID" });
await wrapper.setData({
displayInvalidZipAlert: true,
displayMatchedDifferentVehicleAlert: true,
displayNonServiceableZipAlert: true,
displayVinNotFoundAlert: true,
});
// sanity check that there are alerts
expect(wrapper.findAllComponents({ name: "alert" }).length).toBe(4);
// Act
wrapper.vm.forwardButtonAction();
await wrapper.vm.$nextTick();
// Assert
expect(wrapper.findAllComponents({ name: "alert" }).length).toBe(0);
});
});
});
@ -244,8 +266,8 @@ function mockOutPromises({ carId, isZipValid = true, isZipServiceable = true })
carId: carId,
},
zipCodeData: {
isValid: true,
isServiceable: true,
isValid: isZipValid,
isServiceable: isZipServiceable,
state: "OH",
},
};

View file

@ -226,6 +226,8 @@ export default {
}
},
async forwardButtonAction() {
this.resetAlerts();
// If this is a new VIN Lookup, do both a Vehicle Lookup and a Zip Validation
if (!this.vinPopulatedOnPageLoad) {
const vehicleLookupResponse = this.dispatchStoreAction(
@ -372,6 +374,12 @@ export default {
await this.navigateForwardWithSingleCarMatch();
}
},
resetAlerts() {
this.displayMatchedDifferentVehicleAlert = false;
this.displayNonServiceableZipAlert = false;
this.displayInvalidZipAlert = false;
this.displayVinNotFoundAlert = false;
},
},
mounted() {
this.attachCustomEvents();