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

View file

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

View file

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