This commit is contained in:
CarlNation 2022-02-18 16:03:57 -05:00
parent 3d5e45d47d
commit 470774f03d
3 changed files with 28 additions and 28 deletions

View file

@ -6,6 +6,7 @@ import vehicleBanner from "@/common-components/vehicle-banner/vehicle-banner";
import funnelSubHeader from "@/common-components/funnel-sub-header/funnel-sub-header";
import replaceOptionsQuestion from "@/layouts/vehicle-damage/replace-options-question/replace-options-question";
import damageLocationQuestion from "@/layouts/vehicle-damage/damage-location-question/damage-location-question";
import windshieldOptions from "@/layouts/vehicle-damage/windshield-options/windshield-options";
// Supporting Files
import { settleAllPromises } from "@/helpers/layout-helper.js";
@ -177,7 +178,7 @@ function setupMocks({
availableReplacementOptions: ["Front", "Back", "Side"],
},
windshieldOptions: {
availableReplacementOptions: ["Front", "Back", "Side"],
availableReplacementOptions: ["Single", "Driver", "Passenger"],
},
});
});
@ -198,8 +199,8 @@ function setupMocks({
availableReplacementOptions: ["Front", "Back", "Side"],
},
windshieldOptions: {
availableReplacementOptions: ["Front", "Back", "Side"],
}
availableReplacementOptions: ["Single", "Driver", "Passenger"],
},
},
};
@ -226,12 +227,11 @@ function setupMocks({
initializeComponent: jest.fn(),
};
const windshieldOptions = replaceOptionsQuestion
windshieldOptions.methods = {
damageLocationQuestion.methods = {
initializeComponent: jest.fn(),
};
damageLocationQuestion.methods = {
windshieldOptions.methods = {
initializeComponent: jest.fn(),
};
@ -262,11 +262,13 @@ function setupMocks({
driverSideOptionsWrapper.vm.initializeComponent =
replaceOptionsQuestion.methods.initializeComponent;
const windshieldOptionsWrapper = wrapper.findAllComponents({
name: "replaceOptionsQuestion",
}).at(1);
const windshieldOptionsWrapper = wrapper.findComponent({
name: "windshieldOptions",
});
windshieldOptionsWrapper.vm.initializeComponent =
replaceOptionsQuestion.methods.initializeComponent;
windshieldOptions.methods.initializeComponent;
const damageLocationQuestionWrapper = wrapper.findComponent({
name: "damageLocationQuestion",

View file

@ -34,9 +34,6 @@ import baseMixin from "@/mixins/base-mixin";
export default {
name: "vehicle-damage",
updated() {
console.log(this.selectedWindshieldOptions.selectedWindshieldReplaceOptions);
},
async beforeRouteEnter(to, from, next) {
// Call APIs
const cmsContentPromise = fetchCmsContentForPage(to.query.fmgPage);

View file

@ -8,8 +8,6 @@
:groupName="groupName"
buttonType="listCard"
v-model="selectedValues"
validationRules="windshield-damage-required|checkForRepairAndReplace:@DamageLocationQuestion"
:suppressError="suppressError"
/>
</div>
</transition>
@ -17,21 +15,24 @@
<script>
import buttonQuestion from "@/common-components/button-question/button-question";
import { defineRule } from "vee-validate";
//import { defineRule } from "vee-validate";
//DEFINE VALIDATION RULES
defineRule("windshield-damage-required", (value) => {
if (!value || value.length < 1) {
return "Please select windshield damage";
}
return true;
});
defineRule("checkForRepairAndReplace", (value, [other]) => {
if (value === "Windshield-Chip" && other.toString().includes("Windshield") && other.length > 1) {
return "checkForRepairAndReplace error"
}
return true;
});
// add these to the button component above:
// validationRules="windshield-damage-required|checkForRepairAndReplace:@DamageLocationQuestion"
// :suppressError="suppressError"
// defineRule("windshield-damage-required", (value) => {
// if (!value || value.length < 1) {
// return "Please select windshield damage";
// }
// return true;
// });
// defineRule("checkForRepairAndReplace", (value, [other]) => {
// if (value === "Windshield-Chip" && other.toString().includes("Windshield") && other.length > 1) {
// return "checkForRepairAndReplace error"
// }
// return true;
// });
export default ({
name: "windshieldDamageTypeQuestion",