-
+
-
+
-
@@ -45,6 +45,11 @@ export default {
diff --git a/src/helpers/heritage-integration/navigation-helper.js b/src/helpers/heritage-integration/navigation-helper.js
index 6079c5375..0630d8b65 100644
--- a/src/helpers/heritage-integration/navigation-helper.js
+++ b/src/helpers/heritage-integration/navigation-helper.js
@@ -95,7 +95,7 @@ async function getLatestPageForRedirection() {
else if (partQuestionsComponent.methods.arePagePrerequisitesValid()) {
return fmgPageValues.PART_QUESTIONS;
}
- else if (vinLookupComponent.methods.arePagePrerequisitesValid()) {
+ else if (vinLookupComponent.methods.arePagePrerequisitesValid() && !store.getters.damage.isRepair) {
return fmgPageValues.VIN_LOOKUP;
}
else {
diff --git a/src/layouts/address-lookup/address-lookup.vue b/src/layouts/address-lookup/address-lookup.vue
index ed1ffd3db..a68012e17 100644
--- a/src/layouts/address-lookup/address-lookup.vue
+++ b/src/layouts/address-lookup/address-lookup.vue
@@ -6,7 +6,7 @@
-
+
\ No newline at end of file
diff --git a/src/layouts/estimate/estimate.spec.js b/src/layouts/estimate/estimate.spec.js
index a24bc22b7..5bfb2e517 100644
--- a/src/layouts/estimate/estimate.spec.js
+++ b/src/layouts/estimate/estimate.spec.js
@@ -36,48 +36,6 @@ describe("estimate.vue", () => {
//Assesrt
expect(wrapper.emitted()["update:modelValue"][0]).toEqual([{ modelValue: ["Provide my license plate # Most accurate VIN match"] }]);
});
- test("isRepair is set to true, arePagePrerequisitesValid should return true", async () => {
-
- //Arrange
- const { wrapper } = setupMocks({});
-
- //Act
- store.commit( storeMutations.UPDATE_IS_REPAIR, true );
-
- let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
-
- //Assert
- expect(arePagePrerequisitesValid).toBe(true);
- });
- test("isRepair is set to true, arePagePrerequisitesValid should return true", async () => {
-
- //Arrange
- const { wrapper } = setupMocks({});
-
- //Act
- store.commit( storeMutations.UPDATE_IS_REPAIR, true );
-
- let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
-
- //Assert
- expect(arePagePrerequisitesValid).toBe(true);
- });
- test.todo("isRepair is false and there are no lineItems => should return false")
- test.todo("isRepair is false and lineItems is null => should return false")
- test.todo("isRepair is false are there are lineItems => should return true")
- test("isRepair is set to null, arePagePrerequisitesValid should return false", async () => {
-
- //Arrange
- const { wrapper } = setupMocks({});
-
- //Act
- store.commit( storeMutations.UPDATE_IS_REPAIR, null );
-
- let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
-
- //Assert
- expect(arePagePrerequisitesValid).toBe(false);
- });
test("After selecting provide my home address on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
@@ -132,26 +90,125 @@ describe("estimate.vue", () => {
test("Provide my license plate on ForwardButtonAction triggers a router.navigateWithSaving", async () => {
- //Arrange
- const { wrapper } = setupMocks({});
- await wrapper.setData({
- selectedVinLookupMethod: vinLookupMethodSelections.LICENSEPLATE
- })
-
- //Act
- wrapper.vm.forwardButtonAction();
-
- //Assert
- expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
+ //Arrange
+ const { wrapper } = setupMocks({});
+ await wrapper.setData({
+ selectedVinLookupMethod: vinLookupMethodSelections.LICENSEPLATE
+ })
+
+ //Act
+ wrapper.vm.forwardButtonAction();
+
+ //Assert
+ expect(wrapper.vm.$router.navigateWithSaving).toHaveBeenCalled();
});
+ describe("arePagePrerequisitesValid", () => {
+ beforeEach(() => {
+ store.commit(storeMutations.UPDATE_IS_REPAIR, false);
+ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, null);
+ })
+
+ test("isRepair is false and there are no glassToReplace => should return false", () => {
+ // Arrange
+ const { wrapper } = setupMocks({});
+ store.commit(storeMutations.UPDATE_IS_REPAIR, false);
+ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, []);
+
+ // Act
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ // Assert
+ expect(arePagePrerequisitesValid).toBe(false);
+ })
+
+ test("isRepair is false and glassToReplace is null => should return false", () => {
+ // Arrange
+ const { wrapper } = setupMocks({});
+ store.commit(storeMutations.UPDATE_IS_REPAIR, false);
+ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, null);
+
+ // Act
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ // Assert
+ expect(arePagePrerequisitesValid).toBe(false);
+ })
+
+ test("isRepair is false are there is one glassToReplace => should return true", () => {
+ // Arrange
+ const { wrapper } = setupMocks({});
+ store.commit(storeMutations.UPDATE_IS_REPAIR, false);
+ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [{glassLocation: "TEST", glassName: "NAME"}]);
+
+ // Act
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ // Assert
+ expect(arePagePrerequisitesValid).toBe(true);
+ })
+
+ test("isRepair is false are there are multiple glassToReplace => should return true", () => {
+ // Arrange
+ const { wrapper } = setupMocks({});
+ store.commit(storeMutations.UPDATE_IS_REPAIR, false);
+ store.commit(storeMutations.UPDATE_GLASS_TO_REPLACE, [{glassLocation: "TEST1", glassName: "NAME1"}, {glassLocation: "TEST2", glassName: "NAME2"}, {glassLocation: "TEST3", glassName: "NAME3"}]);
+
+ // Act
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ // Assert
+ expect(arePagePrerequisitesValid).toBe(true);
+ })
+
+ test("isRepair is set to null => arePagePrerequisitesValid should return false", async () => {
+ // Arrange
+ const { wrapper } = setupMocks({});
+ store.commit(storeMutations.UPDATE_IS_REPAIR, null);
+
+ // Act
+ console.log(store.getters.damage)
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ // Assert
+ expect(arePagePrerequisitesValid).toBe(false);
+ });
+
+ test("isRepair is set to true => arePagePrerequisitesValid should return true", async () => {
+ // Arrange
+ const { wrapper } = setupMocks({});
+ store.commit(storeMutations.UPDATE_IS_REPAIR, true);
+
+ // Act
+ let arePagePrerequisitesValid = wrapper.vm.arePagePrerequisitesValid();
+
+ // Assert
+ expect(arePagePrerequisitesValid).toBe(true);
+ });
+ })
+
+ test("Changing zip should reset alert", async () => {
+ //Arrange
+ const { wrapper } = setupMocks({});
+
+ //Act
+ wrapper.vm.displayNonServiceableZipAlert = "true";
+ wrapper.vm.serviceZipCode = "43015";
+
+ await wrapper.vm.$nextTick();
+
+ //Assert
+ expect(wrapper.vm.displayNonServiceableZipAlert).toEqual(false);
+ });
+
});
function setupMocks({
groupName = "estimate",
cmsQuestionText = "Let's get your VIN. Or we can look it up for you!",
cmsAnswers = [{ Name: "Provide my VIN manually Most specific to your vehicle" }, { Name: "Provide my license plate # Most accurate VIN match" }, { Name: "Provide my home address Most convenient VIN match" }],
+ funnelFooterWidget = { ForwardButtonText: "test txt" },
mountOptionsMockData = {
router: {
navigate: jest.fn(),
@@ -165,12 +222,14 @@ function setupMocks({
const cmsContent = {
groupName: groupName,
QuestionText: cmsQuestionText,
- Answers: cmsAnswers
+ Answers: cmsAnswers,
+ FunnelFooterWidget: funnelFooterWidget
};
- const apiPromise = Promise.resolve(cmsContent);
+ const apiPromise = Promise.resolve({ cmsContent });
settleAllPromises.mockImplementation(() => apiPromise);
fetchCmsContentForPage.mockImplementation(() => Promise.resolve());
+
const mountOptions = getMountOptions({ ...mountOptionsMockData, mixins: [baseMixin] });
mountOptions['attachTo'] = document.body;
diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue
index aae192291..faf2c8ed6 100644
--- a/src/layouts/estimate/estimate.vue
+++ b/src/layouts/estimate/estimate.vue
@@ -6,26 +6,86 @@
v-slot="{ meta }"
>
+
-
-
+
+
diff --git a/src/layouts/license-plate-lookup/license-plate-lookup.vue b/src/layouts/license-plate-lookup/license-plate-lookup.vue
index 1b163ef30..90a447258 100644
--- a/src/layouts/license-plate-lookup/license-plate-lookup.vue
+++ b/src/layouts/license-plate-lookup/license-plate-lookup.vue
@@ -36,7 +36,7 @@
/>
-
+
+
+
h1
+
+
h2
+
+
h3
+
+
h4
+
+
h5
+
+
h6
+
+
Body
+
+
Label
+
+
Small
+
+
Caption
+
0) {
- return true;
- }
- return false;
+ return store.getters.order.damage.isRepair || (store.getters.order.lineItems?.glassParts != null && store.getters.order.lineItems.glassParts.length > 0);
}
},
computed: {
diff --git a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue
index 25d273eca..31a681857 100644
--- a/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue
+++ b/src/layouts/vehicle-damage/windshield-options/windshield-chip-count-question/windshield-chip-count-question.vue
@@ -47,7 +47,8 @@ export default ({
return this.modelValue;
},
set: function(newValue) {
- this.$emit("update:modelValue", newValue);
+ const numberValue = Number(newValue);
+ this.$emit("update:modelValue", numberValue);
}
},
},
diff --git a/src/layouts/vehicle-parts/vehicle-parts.spec.js b/src/layouts/vehicle-parts/vehicle-parts.spec.js
index 14c83cfdb..d1eaa8df6 100644
--- a/src/layouts/vehicle-parts/vehicle-parts.spec.js
+++ b/src/layouts/vehicle-parts/vehicle-parts.spec.js
@@ -236,7 +236,7 @@ describe("vehicle-parts.vue", () => {
wrapper.vm.backButtonAction();
//Assert
- expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_PART_QUESTIONS, wrapper.vm.$route);
+ expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_PART_QUESTIONS, wrapper.vm.$route);
});
@@ -277,7 +277,7 @@ describe("vehicle-parts.vue", () => {
wrapper.vm.backButtonAction();
//Assert
- expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_TO_GO_TO_VIN_LOOKUP, wrapper.vm.$route);
+ expect(wrapper.vm.$router.navigateWithoutSaving).toHaveBeenCalledWith(navigationScenarios.CLICKED_BACK_WITH_NO_QUESTIONS, wrapper.vm.$route);
});
diff --git a/src/layouts/vehicle-style/vehicle-style.spec.js b/src/layouts/vehicle-style/vehicle-style.spec.js
index 1dd3a6774..e97b14882 100644
--- a/src/layouts/vehicle-style/vehicle-style.spec.js
+++ b/src/layouts/vehicle-style/vehicle-style.spec.js
@@ -10,6 +10,9 @@ import { getMountOptions } from "@/helpers/unit-test-helper.js";
import { storeActions } from "@/constants/store-actions";
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import baseMixin from "@/mixins/base-mixin.js";
+import router from "@/router"
+import store from "@/store"
+import { storeMutations } from "@/constants/store-mutations";
// Mock our module for promises.
jest.mock("@/helpers/layout-helper.js", () => ({
@@ -21,25 +24,16 @@ jest.mock("@/helpers/cms-content-helper", () => ({
fetchCmsContentForPage: jest.fn(),
}));
-// Mock Store
-jest.mock("@/store", () => ({
- getters: {
- vehicle: {
- model: "TL",
- },
- applicationUser:{
- pageData: {
- "part-questions": null,
- "vehicle-make": {},
- "vehicle-model": {},
- "vehicle-style": {},
- "vehicle-damage": {}
- }
- }
- },
+// Mock fetchCmsContentForPage
+jest.mock("@/router", () => ({
+ overrideNavigation: jest.fn(),
}));
describe("vehicle-style.vue", () => {
+ beforeEach(() => {
+ jest.clearAllMocks();
+ })
+
test("Style question component is initized with api data", async (done) => {
//Arrange
const styleQuestionInitialData = ["2 Door", "4 Door"];
@@ -63,9 +57,7 @@ describe("vehicle-style.vue", () => {
done();
});
});
-});
-describe("vehicle-style.vue", () => {
test("BackButtonAction triggers a router.navigateWithoutSaving change", async (done) => {
//Arrange
const { wrapper, apiPromise } = setupMocks({
@@ -95,20 +87,12 @@ describe("vehicle-style.vue", () => {
done();
});
});
-});
-describe("vehicle-style.vue", () => {
- test("selectVehicle triggers a dispatchStoreAction commit", async (done) => {
+ test("setVehicle triggers a dispatchStoreAction commit", async (done) => {
//Arrange
const { wrapper, apiPromise } = setupMocks({
pageHeaderWidgetHeaderText: "Select a style to get started",
mountOptionsMockData: {
- store: {
- commit: jest.fn(),
- getters: {
- vehicle: {},
- },
- },
actionList: [
{
actionName: storeActions.SET_VEHICLE,
@@ -134,9 +118,7 @@ describe("vehicle-style.vue", () => {
done();
});
});
-});
-describe("vehicle-style.vue", () => {
test("Model set, arePagePrerequisitesValid should be true ", async () => {
//Arrange
const { wrapper } = setupMocks({});
@@ -155,7 +137,61 @@ describe("vehicle-style.vue", () => {
//Assert
expect(arePagePrerequisitesValid).toBe(true);
});
+
+ test("there is only one vehicle style => autoselect and move to vehicle damage", async () => {
+ //Arrange
+ const { wrapper } = setupMocks({
+ styleQuestionInitialData: ["2 door sedan"],
+ });
+
+ // Act
+ await vehicleStyle.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "vehicle-style" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ // Assert
+ expect(store.commit).toHaveBeenCalledWith(storeMutations.UPDATE_STYLE, "2 door sedan");
+ expect(router.overrideNavigation).toHaveBeenCalled();
+ })
+
+ test("there is only one vehicle style and vehicle-damage was visited => don't autoselect or move to vehicle damage", async () => {
+ //Arrange
+ const { wrapper } = setupMocks({
+ styleQuestionInitialData: ["2 door sedan"],
+ mountOptionsMockData: {
+ store: {
+ getters: {
+ applicationUser: {
+ pageData: {
+ "part-questions": null,
+ "vehicle-make": {},
+ "vehicle-model": {},
+ "vehicle-style": {},
+ "vehicle-damage": {}
+ }
+ }
+ }
+ }
+ }
+ });
+
+ // Act
+ await vehicleStyle.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "vehicle-style" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ // Assert
+ expect(store.commit).not.toHaveBeenCalledWith(storeMutations.UPDATE_STYLE, "2 door sedan");
+ expect(router.overrideNavigation).not.toHaveBeenCalled();
+ })
});
+
function setupMocks({
vehicleStyleQuestionCmsContent = {},
styleQuestionInitialData = {},
@@ -190,7 +226,26 @@ function setupMocks({
initializeComponent: jest.fn(),
};
- const mountOptions = getMountOptions(mountOptionsMockData);
+ store.commit = jest.fn();
+ store.dispatch = jest.fn();
+ store.getters = mountOptionsMockData.store?.getters ?? {
+ vehicle: {
+ model: "TL",
+ },
+ applicationUser: {
+ pageData: {
+ "part-questions": null,
+ "vehicle-make": {},
+ "vehicle-model": {},
+ "vehicle-style": {},
+ }
+ }
+ }
+
+ const mountOptions = getMountOptions({
+ ...mountOptionsMockData,
+ store
+ });
const wrapper = shallowMount(vehicleStyle, mountOptions);
wrapper.vm.setCmsContent = baseMixin.methods.setCmsContent;
diff --git a/src/layouts/vehicle-style/vehicle-style.vue b/src/layouts/vehicle-style/vehicle-style.vue
index b86914520..4a31c06cc 100644
--- a/src/layouts/vehicle-style/vehicle-style.vue
+++ b/src/layouts/vehicle-style/vehicle-style.vue
@@ -26,6 +26,7 @@