CSR-2195 | Formatting and unit test fix

This commit is contained in:
Scott Kiener 2024-09-06 15:36:24 -04:00
parent 6f48f0ae4d
commit 1daaa863bf
3 changed files with 29 additions and 46 deletions

View file

@ -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

View file

@ -46,7 +46,7 @@ export default {
data() {
return {
valueToEmit: null,
buttonId: uuidv4()
buttonId: uuidv4(),
};
},
mounted() {

View file

@ -186,7 +186,7 @@ export default {
selectedDoorSides: [],
selectedDriverSideReplaceOptions: [],
selectedPassengerSideReplaceOptions: [],
}
};
} else {
if (!this.isDriverSideReplace) {
this.sideDoorOptionsData.selectedDriverSideReplaceOptions = [];
@ -202,8 +202,8 @@ export default {
this.selectedWindshieldOptions = {
selectedWindshieldDamageType: "",
selectedWindshieldChipCount: null,
selectedWindshieldReplaceOptions: []
}
selectedWindshieldReplaceOptions: [],
};
} else {
if (!this.isWindshieldRepair) {
this.selectedWindshieldOptions.selectedWindshieldChipCount = null;
@ -615,25 +615,39 @@ export default {
return this.$store.getters.requiresVerifiedRedirecting;
},
isContinueEnabled() {
return this.isAnyDamageSelected && this.isWindshieldValid && this.isRearGlassValid && this.isSideGlassValid;
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) {
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) {
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) {
if (
this.sideDoorOptionsData.selectedDriverSideReplaceOptions == null ||
this.sideDoorOptionsData.selectedDriverSideReplaceOptions.length == 0
) {
// DriverSide is selected, but no sub option is
return false;
}
@ -669,7 +683,12 @@ export default {
return false;
}
} else {
if (this.selectedWindshieldOptions.selectedWindshieldReplaceOptions == null || this.selectedWindshieldOptions.selectedWindshieldReplaceOptions.length == 0) {
if (
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions ==
null ||
this.selectedWindshieldOptions.selectedWindshieldReplaceOptions
.length == 0
) {
// Replace selected but follow-up split/single question not answered
return false;
}
@ -682,7 +701,7 @@ export default {
watch: {
selectedDamageLocations() {
this.clearChildEntries();
}
},
},
components: {