commit
e7e7391866
2 changed files with 32 additions and 2 deletions
|
|
@ -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",
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue