Merge pull request #288 from Safelite/feature/digital/SSR-390
Feature/digital/ssr 390
This commit is contained in:
commit
af8ecf5e9f
3 changed files with 9 additions and 16 deletions
|
|
@ -83,7 +83,7 @@ describe("glass-part-question.vue", () => {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
const { wrapper } = setupMocks(featureListData);
|
const { wrapper } = setupMocks(featureListData);
|
||||||
|
|
||||||
//Act
|
//Act
|
||||||
|
|
@ -94,7 +94,7 @@ describe("glass-part-question.vue", () => {
|
||||||
await wrapper.setData({ selectedTint: "Green Tint" });
|
await wrapper.setData({ selectedTint: "Green Tint" });
|
||||||
// to trigger the computed setter
|
// to trigger the computed setter
|
||||||
wrapper.vm.selectedPartNumber = "DB12209GTYN";
|
wrapper.vm.selectedPartNumber = "DB12209GTYN";
|
||||||
|
|
||||||
//Assert
|
//Assert
|
||||||
expect(wrapper.emitted()["update:modelValue"][0]).toEqual([
|
expect(wrapper.emitted()["update:modelValue"][0]).toEqual([
|
||||||
{ partNumber: "DB12209GTYN", color: "Green Tint" },
|
{ partNumber: "DB12209GTYN", color: "Green Tint" },
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ import { errorMessages } from "@/constants/error-messages";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "glass-part-question",
|
name: "glass-part-question",
|
||||||
|
emits: ["update:modelValue"],
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
@ -117,10 +118,8 @@ export default {
|
||||||
return this.modelValue?.partNumber;
|
return this.modelValue?.partNumber;
|
||||||
},
|
},
|
||||||
set(newValue) {
|
set(newValue) {
|
||||||
this.$emit(
|
const part = this.partsForSelectedTint.filter((part) => part.partNumber == newValue?.value)[0];
|
||||||
"update:modelValue",
|
this.$emit("update:modelValue", part);
|
||||||
this.partsForSelectedTint.filter((part) => part.partNumber == newValue.value)[0]
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -181,13 +180,6 @@ export default {
|
||||||
return tintSourceObject.src;
|
return tintSourceObject.src;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Reset selections when tint changes for the same glass to ensure proper selection.
|
|
||||||
// Also checks if only a single part is present for the tint.
|
|
||||||
ResetTintAndPartSelections() {
|
|
||||||
this.selectedPartNumber = null;
|
|
||||||
this.AutoSelectIfSinglePart();
|
|
||||||
},
|
|
||||||
|
|
||||||
AutoSelectIfSinglePart() {
|
AutoSelectIfSinglePart() {
|
||||||
if (this.partsForSelectedTint?.length > 0)
|
if (this.partsForSelectedTint?.length > 0)
|
||||||
{
|
{
|
||||||
|
|
@ -202,6 +194,9 @@ export default {
|
||||||
radioInput?.click();
|
radioInput?.click();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
this.selectedPartNumber = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -108,9 +108,7 @@ data() {
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
isForwardActionDisabled() {
|
isForwardActionDisabled() {
|
||||||
return (
|
return this.selectedGlassPartNumbers.length !== this.PartsFromApi.partsOrQuestions.length
|
||||||
this.selectedGlassPartNumbers.length !== this.PartsFromApi.partsOrQuestions.length
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
selectedGlassPartNumbers() {
|
selectedGlassPartNumbers() {
|
||||||
// Compile all selected parts from the page.
|
// Compile all selected parts from the page.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue