Merge pull request #3267 from Safelite/feature/CASH-3041
CASH-3041: Fix loading spinner
This commit is contained in:
commit
ecdef34a4c
2 changed files with 33 additions and 6 deletions
|
|
@ -168,6 +168,23 @@ describe("vin-lookup.vue", () => {
|
||||||
expect(wrapper.vm.navigateForward).not.toHaveBeenCalled();
|
expect(wrapper.vm.navigateForward).not.toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("Should keep the continue button loader spinning for vinRequired vehicles when VIN lookup fails", async () => {
|
||||||
|
// Arrange
|
||||||
|
store.getters.vehicle.vinRequired = true;
|
||||||
|
const { wrapper } = setupMocks({});
|
||||||
|
mockOutPromises({ vehicleLookupFailed: true });
|
||||||
|
wrapper.vm.continueWithFailedVin = jest.fn().mockResolvedValue();
|
||||||
|
wrapper.setData({ vin: "1HGCM82633A123456", vinPopulatedOnPageLoad: false });
|
||||||
|
|
||||||
|
// Act
|
||||||
|
await wrapper.vm.forwardButtonAction();
|
||||||
|
|
||||||
|
// Assert
|
||||||
|
expect(wrapper.vm.continueWithFailedVin).toHaveBeenCalled();
|
||||||
|
expect(wrapper.vm.$refs.navbar.removeLoader).not.toHaveBeenCalled();
|
||||||
|
store.getters.vehicle.vinRequired = false;
|
||||||
|
});
|
||||||
|
|
||||||
describe("navigateForward", () => {
|
describe("navigateForward", () => {
|
||||||
test("carId is different from returned vehicle and selected glass isn't available => continue with different glass", async () => {
|
test("carId is different from returned vehicle and selected glass isn't available => continue with different glass", async () => {
|
||||||
// Arrange
|
// Arrange
|
||||||
|
|
@ -394,11 +411,14 @@ function setupMocks({ customMountOptions }) {
|
||||||
return { wrapper };
|
return { wrapper };
|
||||||
}
|
}
|
||||||
|
|
||||||
function mockOutPromises({ carId, isZipValid = true, isZipServiceable = true }) {
|
function mockOutPromises({
|
||||||
|
carId,
|
||||||
|
isZipValid = true,
|
||||||
|
isZipServiceable = true,
|
||||||
|
vehicleLookupFailed = false,
|
||||||
|
}) {
|
||||||
const apiResponses = {
|
const apiResponses = {
|
||||||
vehicleLookupResponse: {
|
vehicleLookupResponse: vehicleLookupFailed ? undefined : { carId: carId },
|
||||||
carId: carId,
|
|
||||||
},
|
|
||||||
zipCodeData: {
|
zipCodeData: {
|
||||||
isValid: isZipValid,
|
isValid: isZipValid,
|
||||||
isServiceable: isZipServiceable,
|
isServiceable: isZipServiceable,
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,14 @@ export default {
|
||||||
const isVinLookupRequired = this.$store.getters.vehicle.vinRequired;
|
const isVinLookupRequired = this.$store.getters.vehicle.vinRequired;
|
||||||
if (isVinLookupRequired) {
|
if (isVinLookupRequired) {
|
||||||
this.requiredVinNotFound = true;
|
this.requiredVinNotFound = true;
|
||||||
this.continueWithFailedVin(this.vin, resultMap.zipCodeData);
|
|
||||||
|
// Check if Service Zip entered is serviceable, if not display an alert
|
||||||
|
if (!resultMap.zipCodeData.isServiceable) {
|
||||||
|
this.displayNonServiceableZipAlert = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
await this.continueWithFailedVin(this.vin, resultMap.zipCodeData);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
this.displayVinNotFoundAlert = true;
|
this.displayVinNotFoundAlert = true;
|
||||||
}
|
}
|
||||||
|
|
@ -521,7 +528,7 @@ export default {
|
||||||
},
|
},
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
this.navigateForwardWithSingleCarMatch();
|
await this.navigateForwardWithSingleCarMatch();
|
||||||
},
|
},
|
||||||
getRequiredVinNotFound() {
|
getRequiredVinNotFound() {
|
||||||
// Prevents success alert from showing
|
// Prevents success alert from showing
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue