Checkbox
@@ -1040,6 +1109,8 @@
import checkbox from "@/ux-components/checkbox/checkbox";
import radio from "@/ux-components/radio/radio";
import textLink from "@/ux-components/text-link/text-link";
+ import textboxQuestion from "@/common-components/textbox-question/textbox-question";
+ import dropdownQuestion from "@/common-components/dropdown-question/dropdown-question";
export default {
name: "App",
components: {
@@ -1051,7 +1122,9 @@
listButtonHorizontal,
checkbox,
radio,
- textLink
+ textLink,
+ textboxQuestion,
+ dropdownQuestion,
},
data() {
return {
diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js
index 8a5ad8a50..a6ee43924 100644
--- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js
+++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.spec.js
@@ -1,76 +1,124 @@
import { shallowMount } from "@vue/test-utils";
import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question";
import { getMountOptions } from "@/helpers/unit-test-helper.js";
+import { nextTick } from "vue";
import store from "@/store";
jest.mock("@/store", () => { return {}; }, {virtual: true});
describe("replace-options-question.vue", () => {
- test("Selected damage option is emitted upon selection.", async () => {
-
- //Arrange
- const { wrapper } = setupMocks({ modelValueProp: ["Windshield"] });
- const damageToSelect = ["Backseat"];
-
- //Act
- wrapper.setValue({ modelValue: damageToSelect });
- await wrapper.vm.$nextTick();
-
- //Assert
- expect(wrapper.emitted()["update:modelValue"][0]).toEqual([{modelValue: ["Backseat"]}]);
- });
- });
+ test("Selected damage option is emitted upon selection.", async () => {
- describe("replace-options-question.vue", () => {
- test("Answers to display filtered by data from api.", async () => {
-
- //Arrange
- const { wrapper, cmsContent, replaceOptions } = setupMocks({ dataFromStoreApi: ["Windshield", "FrontDoor"], filterByVehicleCategory: true});
-
- //Act
- replaceOptionsQuestion.methods.initializeComponent.call(wrapper.vm, cmsContent, replaceOptions, "car-group");
-
- //Assert
- expect(wrapper.vm.answersToDisplay).toStrictEqual([ { Name: 'Windshield' }, { Name: 'FrontDoor' } ])
- });
- });
+ //Arrange
+ const { wrapper } = setupMocks({ modelValueProp: ["Windshield"] });
+ const damageToSelect = ["Backseat"];
- function setupMocks({
- modelValueProp = ["Windshield"],
- isAvailale = true,
- isMultiSelect = false,
- filterByVehicleCategory = false,
- groupName = "damageQuestion",
- cmsQuestionText = "CMS text goes here",
- cmsAnswers = [{Name: "car-Windshield"}, {Name: "car-BackDoor"}, {Name: "car-FrontDoor"}],
- dataFromStoreApi = [],
- }) {
-
- //Mock store
- store.dispatch = jest.fn(() => dataFromStoreApi);
- store.getters = { vehicle: {year: 2019, make: 'honda', model: 'civc', style: '2 Door', category: 'CAR'} };
- const mountOptions = getMountOptions({
- store: {
- dispatch: store.dispatch,
- getters: store.getters,
+ //Act
+ wrapper.setValue({ modelValue: damageToSelect });
+ await wrapper.vm.$nextTick();
+
+ //Assert
+ expect(wrapper.emitted()["update:modelValue"][0]).toEqual([{modelValue: ["Backseat"]}]);
+ });
+});
+
+describe("replace-options-question.vue", () => {
+ test("Answers to display filtered by data from api.", async () => {
+
+ //Arrange
+ const { wrapper, cmsContent, replaceOptions } = setupMocks({ dataFromStoreApi: ["Windshield", "FrontDoor"], filterByVehicleCategory: true});
+
+ //Act
+ replaceOptionsQuestion.methods.initializeComponent.call(wrapper.vm, cmsContent, replaceOptions, "car-group");
+
+ //Assert
+ expect(wrapper.vm.answersToDisplay).toStrictEqual([ { Name: 'Windshield' }, { Name: 'FrontDoor' } ])
+ });
+});
+
+describe("replace-options-question.vue", () => {
+ test("when updateSelectedValues method is called with a single answerToDisplay it will call to update this.selectedValues", async () => {
+
+ //Arrange
+ const { wrapper, cmsContent, replaceOptions
+ } = setupMocks({
+ modelValueProp: [],
+ });
+ wrapper.setData({answersFromCms: [
+ {
+ "Name": "Stationary",
},
- });
+ {
+ "Name": "Slider",
+ }
+ ]});
+ wrapper.setData({replaceOptions: ["Stationary"]});
+
+ //Act
+ wrapper.vm.$options.methods.updateSelectedValues.call(wrapper.vm);
+
+ expect(wrapper.emitted()["update:modelValue"][0]).toEqual([['Stationary']]);
+ });
+});
+
+describe("replace-options-question.vue", () => {
+ test("when isAvailable is true, will run updateSelectedValues method", async () => {
+
+ //Arrange
+ const { wrapper, cmsContent, replaceOptions } = setupMocks({ isAvailable: false, methodsToMock: ["updateSelectedValues"] });
+
+ //Act
+ wrapper.vm.$options.methods.initializeComponent.call(wrapper.vm, cmsContent, replaceOptions, "car-group");
+ wrapper.vm.$options.watch.isAvailable.call(wrapper.vm, true);
+
+ //Assert
+ expect(replaceOptionsQuestion.methods.updateSelectedValues).toHaveBeenCalled();
+ wrapper.unmount();
+ });
+});
+
+function setupMocks({
+ modelValueProp = ["Windshield"],
+ isAvailable = true,
+ isMultiSelect = false,
+ filterByVehicleCategory = false,
+ groupName = "damageQuestion",
+ cmsQuestionText = "CMS text goes here",
+ cmsAnswers = [{Name: "car-Windshield"}, {Name: "car-BackDoor"}, {Name: "car-FrontDoor"}],
+ dataFromStoreApi = [],
+ methodsToMock = [],
+}) {
- //Mock props
- mountOptions.propsData = {
- modelValue: modelValueProp,
- isAvailable: isAvailale,
- isMultiSelect: isMultiSelect,
- filterByVehicleCategory: filterByVehicleCategory
- };
-
- const wrapper = shallowMount(replaceOptionsQuestion, mountOptions);
+ //Mock store
+ store.dispatch = jest.fn(() => dataFromStoreApi);
+ store.getters = { vehicle: {year: 2019, make: 'honda', model: 'civc', style: '2 Door', category: 'CAR'} };
+ const mountOptions = getMountOptions({
+ store: {
+ dispatch: store.dispatch,
+ getters: store.getters,
+ },
+ });
+
+ //Mock props
+ mountOptions.propsData = {
+ modelValue: modelValueProp,
+ isAvailable: isAvailable,
+ isMultiSelect: isMultiSelect,
+ filterByVehicleCategory: filterByVehicleCategory
+ };
+
+ //Mock methods
+ methodsToMock.forEach((methodName) => {
+ replaceOptionsQuestion.methods[methodName] = jest.fn();
+ });
- //Mock CMS content
- const cmsContent = {
- groupName: groupName,
- QuestionText: cmsQuestionText,
- Answers: cmsAnswers,
- };
- const replaceOptions = dataFromStoreApi;
- return { wrapper, cmsContent, replaceOptions };
- }
\ No newline at end of file
+ const wrapper = shallowMount(replaceOptionsQuestion, mountOptions);
+
+ //Mock CMS content
+ const cmsContent = {
+ groupName: groupName,
+ QuestionText: cmsQuestionText,
+ Answers: cmsAnswers,
+ };
+ const replaceOptions = dataFromStoreApi;
+ return { wrapper, cmsContent, replaceOptions };
+}
\ No newline at end of file
diff --git a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
index 1de360f7b..abe43e429 100644
--- a/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
+++ b/src/layouts/vehicle-damage/replace-options-question/replace-options-question.vue
@@ -1,10 +1,10 @@
-
+
{
});
});
+describe("vehicle-damage.vue", () => {
+ test("BackButtonAction triggers a router.navigate change", async () => {
+
+ //Arrange
+ const { wrapper } = setupMocks({});
+
+ //Act
+ vehicleDamage.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "vehicle-damage" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ wrapper.vm.backButtonAction();
+
+ //Assert
+ expect(wrapper.vm.$router.navigate).toHaveBeenCalled();
+
+ });
+});
+
+describe("vehicle-damage.vue", () => {
+ test("isRearWindowDamageLocation is true if Rear Window damage is selected", async () => {
+
+ //Arrange
+ const { wrapper } = setupMocks({});
+
+ //Act
+ vehicleDamage.beforeRouteEnter.call(
+ wrapper.vm,
+ { query: { fmgPage: "vehicle-damage" } },
+ undefined,
+ (c) => c(wrapper.vm)
+ );
+
+ wrapper.vm.selectedDamageLocations = ["RearWindow"];
+
+ //Assert
+ expect(wrapper.vm.isRearWindowDamageLocation).toEqual(true);
+
+ });
+});
+
function setupMocks({
pageHeaderWidgetHeaderText = {},
- mountOptionsMockData = {},
+ mountOptionsMockData = {
+ router: {
+ navigate: jest.fn(),
+ },
+ },
}) {
//Mock api responses
baseMixin.methods.dispatchNonBlockingStoreAction = jest.fn();
@@ -194,6 +243,9 @@ function setupMocks({
windshieldOptions: {
availableReplacementOptions: ["Single", "Driver", "Passenger"],
},
+ backGlassOptions: {
+ availableReplacementOptions: ["Front", "Back", "Side"],
+ },
},
};
@@ -227,6 +279,10 @@ function setupMocks({
initializeComponent: jest.fn(),
};
+ replaceOptionsQuestion.methods = {
+ initializeComponent: jest.fn(),
+ };
+
funnelFooter.methods = {
initializeComponent: jest.fn(),
}
@@ -259,6 +315,12 @@ function setupMocks({
funnelSubHeaderWrapper.vm.initializeComponent =
funnelSubHeader.methods.initializeComponent;
+ const backGlassOptionsWrapper = wrapper.findComponent({
+ name: "replaceOptionsQuestion",
+ });
+ backGlassOptionsWrapper.vm.initializeComponent =
+ replaceOptionsQuestion.methods.initializeComponent;
+
const damageLocationQuestionWrapper = wrapper.findComponent({
name: "damageLocationQuestion",
});
diff --git a/src/layouts/vehicle-damage/vehicle-damage.vue b/src/layouts/vehicle-damage/vehicle-damage.vue
index bce74b92f..edbaf3a0c 100644
--- a/src/layouts/vehicle-damage/vehicle-damage.vue
+++ b/src/layouts/vehicle-damage/vehicle-damage.vue
@@ -3,12 +3,28 @@
-
-
+
-
+
+
@@ -22,6 +38,7 @@ import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-he
import sideDoorOptions from "@/layouts/vehicle-damage/side-door-options/side-door-options";
import damageLocationQuestion from "@/layouts/vehicle-damage/damage-location-question/damage-location-question";
import windshieldOptions from "@/layouts/vehicle-damage/windshield-options/windshield-options";
+import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question";
// Supporting files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
@@ -77,11 +94,22 @@ export default {
resultMap.cmsContent.WindshieldDamageTypeQuestion, resultMap.cmsContent.WindshieldChipCountQuestion,
resultMap.cmsContent.WindshieldReplaceOptionsQuestion, resultMap.damageOptions.windshieldOptions.availableReplacementOptions
);
+ vm.$refs.backGlassOptions.initializeComponent(
+ resultMap.cmsContent.RearReplaceOptionsQuestion, resultMap.damageOptions.backGlassOptions.availableReplacementOptions
+ );
vm.$refs.funnelFooter.initializeComponent(
resultMap.cmsContent.FunnelFooterWidget
);
});
},
+ computed: {
+ isRearWindowDamageLocation() {
+ return this.selectedDamageLocations.some(selectedDamages =>
+ {
+ return selectedDamages.toUpperCase() === "REARWINDOW";
+ });
+ },
+ },
data(){
return {
selectedDamageLocations: [],
@@ -90,7 +118,8 @@ export default {
selectedDriverSideReplacOptions: [],
selectedPassengerSideReplaceOptions: []
},
- selectedWindshieldOptions: []
+ selectedWindshieldOptions: [],
+ selectedRearReplaceOptions: [],
}
},
methods: {
@@ -117,6 +146,7 @@ export default {
sideDoorOptions,
damageLocationQuestion,
windshieldOptions,
+ replaceOptionsQuestion,
},
};
diff --git a/src/styles/common-animations.scss b/src/styles/common-animations.scss
index 5af3326b8..92f5407ed 100644
--- a/src/styles/common-animations.scss
+++ b/src/styles/common-animations.scss
@@ -1,6 +1,9 @@
-.fade-enter-active,
-.fade-leave-active {
- transition: opacity 0.3s ease;
+.fade-enter-active{
+ transition: opacity 0.6s ease;
+}
+
+.fade-leave-active {
+ transition: opacity 0.3s ease;
}
.fade-enter-from,
diff --git a/src/styles/common-error-styles.scss b/src/styles/common-error-styles.scss
index 4b9a18114..b5017fc60 100644
--- a/src/styles/common-error-styles.scss
+++ b/src/styles/common-error-styles.scss
@@ -1,10 +1,10 @@
.has-error {
&.list-button,
&.list-card {
- border: 1px solid transparent;
+ border: 1px solid $red;
color: $red;
label {
- border: 1px solid $red;
+ box-shadow: 0 0 1px $red;
border-radius: .5rem;
}
}
@@ -32,6 +32,19 @@
border: 1px solid $blue;
}
}
+ &.textbox-question,
+ &.dropdown-question {
+ p {
+ color: $red;
+ }
+ input,
+ select {
+ border: 1px solid $red;
+ &:focus {
+ border: 1px solid transparent;
+ }
+ }
+ }
}
.form-test-error {