Merge branch 'develop' into feature/CSR-2193
This commit is contained in:
commit
c9b2f1c152
3 changed files with 122 additions and 43 deletions
|
|
@ -1123,42 +1123,6 @@ describe("baseInputButton.vue", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("buttonId", () => {
|
||||
test("groupName and value combo yield correct id for input button with string value", () => {
|
||||
// Arrange/Act
|
||||
const { wrapper } = setupMocks({
|
||||
mockData: {
|
||||
propsData: {
|
||||
groupName: "my test-name",
|
||||
value: "Aaa-BBB CcC",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Assert
|
||||
const inputElement = wrapper.find("input");
|
||||
expect(wrapper.vm.buttonId).toBe("my-test-name-Aaa-BBB-CcC");
|
||||
expect(inputElement.attributes().id).toBe("my-test-name-Aaa-BBB-CcC");
|
||||
});
|
||||
|
||||
test("groupName and value combo yield correct id for input button with number value", () => {
|
||||
// Arrange/Act
|
||||
const { wrapper } = setupMocks({
|
||||
mockData: {
|
||||
propsData: {
|
||||
groupName: "my test-name",
|
||||
value: 2,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
// Assert
|
||||
const inputElement = wrapper.find("input");
|
||||
expect(wrapper.vm.buttonId).toBe("my-test-name-2");
|
||||
expect(inputElement.attributes().id).toBe("my-test-name-2");
|
||||
});
|
||||
});
|
||||
|
||||
describe("inputType", () => {
|
||||
test("isMultiSelect is true => inputType is 'checkbox'", () => {
|
||||
// Arrange/Act
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ import {
|
|||
handleInputComponentBlur,
|
||||
} from "@/helpers/button-question-focus-helper";
|
||||
import { inputButtonProps } from "@/digital-components/base-input-button/button-functionality-props";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export default {
|
||||
name: "base-input-button",
|
||||
|
|
@ -45,6 +46,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
valueToEmit: null,
|
||||
buttonId: uuidv4(),
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
|
|
@ -153,11 +155,6 @@ export default {
|
|||
inputType() {
|
||||
return this.isMultiSelect ? "checkbox" : "radio";
|
||||
},
|
||||
buttonId() {
|
||||
return `${this.groupName?.replace(" ", "-")}-${this.value
|
||||
?.toString()
|
||||
?.replace(" ", "-")}`;
|
||||
},
|
||||
isValueSelectedOnClick() {
|
||||
return this.isMultiSelect || this.selectingInitiatesLoad;
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<template>
|
||||
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm" v-slot="{ meta }">
|
||||
<Form @submit="onSubmit" @invalid-submit="onInvalidSubmit" ref="theForm">
|
||||
<div class="container-fluid page-container-grouped-styles vehicle-damage">
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
|
|
@ -70,7 +70,7 @@
|
|||
<div class="col-md-6 col-xl-4">
|
||||
<navbar
|
||||
cmsWidgetName="FunnelFooterWidget"
|
||||
:isForwardActionDisabled="!meta.valid"
|
||||
:isForwardActionDisabled="!isContinueEnabled"
|
||||
:isBackButtonHidden="shouldHideBackButton"
|
||||
@back-clicked="backButtonAction"
|
||||
@ForwardClicked="forwardButtonAction" />
|
||||
|
|
@ -180,6 +180,36 @@ export default {
|
|||
this.attachCustomEvents();
|
||||
},
|
||||
methods: {
|
||||
clearChildEntries() {
|
||||
if (!this.isSideDoorDamageLocation) {
|
||||
this.sideDoorOptionsData = {
|
||||
selectedDoorSides: [],
|
||||
selectedDriverSideReplaceOptions: [],
|
||||
selectedPassengerSideReplaceOptions: [],
|
||||
};
|
||||
} else {
|
||||
if (!this.isDriverSideReplace) {
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions = [];
|
||||
}
|
||||
if (!this.isPassengerSideReplace) {
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions = [];
|
||||
}
|
||||
}
|
||||
if (!this.isRearWindowDamageLocation) {
|
||||
this.selectedRearReplaceOptions = "";
|
||||
}
|
||||
if (!this.isWindshieldDamageLocation) {
|
||||
this.selectedWindshieldOptions = {
|
||||
selectedWindshieldDamageType: "",
|
||||
selectedWindshieldChipCount: null,
|
||||
selectedWindshieldReplaceOptions: [],
|
||||
};
|
||||
} else {
|
||||
if (!this.isWindshieldRepair) {
|
||||
this.selectedWindshieldOptions.selectedWindshieldChipCount = null;
|
||||
}
|
||||
}
|
||||
},
|
||||
arePagePrerequisitesValid() {
|
||||
if (store.getters.vehicle.carId) {
|
||||
return true;
|
||||
|
|
@ -584,6 +614,94 @@ export default {
|
|||
shouldHideBackButton() {
|
||||
return this.$store.getters.requiresVerifiedRedirecting;
|
||||
},
|
||||
isContinueEnabled() {
|
||||
return (
|
||||
this.isAnyDamageSelected &&
|
||||
this.isWindshieldValid &&
|
||||
this.isRearGlassValid &&
|
||||
this.isSideGlassValid
|
||||
);
|
||||
},
|
||||
isAnyDamageSelected() {
|
||||
return this.selectedDamageLocations != null && this.selectedDamageLocations.length != 0;
|
||||
},
|
||||
isSideGlassValid() {
|
||||
if (this.isSideDoorDamageLocation) {
|
||||
if (
|
||||
this.sideDoorOptionsData.selectedDoorSides == null ||
|
||||
this.sideDoorOptionsData.selectedDoorSides == 0
|
||||
) {
|
||||
// SideDoor is selected, but "which side" question is unanswered
|
||||
return false;
|
||||
} else {
|
||||
if (this.isPassengerSideReplace) {
|
||||
if (
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions == null ||
|
||||
this.sideDoorOptionsData.selectedPassengerSideReplaceOptions.length == 0
|
||||
) {
|
||||
// PassengerSide is selected, but no sub option is
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (this.isDriverSideReplace) {
|
||||
if (
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions == null ||
|
||||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.length == 0
|
||||
) {
|
||||
// DriverSide is selected, but no sub option is
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
isRearGlassValid() {
|
||||
if (this.isRearWindowDamageLocation) {
|
||||
if (!this.selectedRearReplaceOptions) {
|
||||
// RearDoor is selected, but rear option question is unanswered
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
isWindshieldValid() {
|
||||
if (this.isWindshieldDamageLocation) {
|
||||
if (!this.selectedWindshieldOptions.selectedWindshieldDamageType) {
|
||||
// Windshield is selected but no replace/repair option is selected
|
||||
return false;
|
||||
} else {
|
||||
if (this.hasSplitSingleConflict) {
|
||||
return false;
|
||||
}
|
||||
if (this.isWindshieldRepair) {
|
||||
if (this.hasRepairReplaceConflict) {
|
||||
return false;
|
||||
}
|
||||
if (!this.selectedWindshieldOptions.selectedWindshieldChipCount) {
|
||||
// Repair selected but no chips selected
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions ==
|
||||
null ||
|
||||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
|
||||
.length == 0
|
||||
) {
|
||||
// Replace selected but follow-up split/single question not answered
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
selectedDamageLocations() {
|
||||
this.clearChildEntries();
|
||||
},
|
||||
},
|
||||
|
||||
components: {
|
||||
|
|
|
|||
Loading…
Reference in a new issue