Moved 'useForm' into modal component

This commit is contained in:
Leah Schumann 2023-02-13 15:06:18 -05:00
parent 9fa85f6295
commit eb87accfb7
4 changed files with 7 additions and 15 deletions

View file

@ -1,10 +1,14 @@
import { shallowMount } from "@vue/test-utils";
import Modal from "./modal";
import crypto from "crypto";
import { useForm } from "vee-validate";
const modalId = "modal-one";
const footerButtonText = "Sample footer text here.";
const headerText = "Sample header text here.";
global.crypto = crypto;
describe("modal.vue", () => {
it("Should display footer button text when footerButtonText is defined", async () => {
const wrapper = shallowMount(Modal, {

View file

@ -43,7 +43,7 @@
<script>
import buttonMain from "@/ux-components/button-main/button-main";
import { Modal } from "bootstrap";
import { useIsFormTouched, useIsFormDirty, useIsFormValid } from "vee-validate";
import { useForm, useIsFormTouched, useIsFormDirty, useIsFormValid } from "vee-validate";
export default {
name: "modal",
@ -60,12 +60,14 @@ export default {
setup() {
const modalId = `modal-${crypto.randomUUID()}`;
const modalForm = useForm();
const isTouched = useIsFormTouched();
const isDirty = useIsFormDirty();
const isValid = useIsFormValid();
return {
modalId,
modalForm,
isTouched,
isDirty,
isValid,

View file

@ -68,13 +68,6 @@ export default {
},
};
},
setup() {
const modalForm = useForm();
return {
modalForm,
};
},
props: {
modelValue: {
type: Object,

View file

@ -71,13 +71,6 @@ export default {
textboxQuestionWidgetName: String,
alertInvalidZipWidgetName: String,
},
setup() {
const modalForm = useForm();
return {
modalForm,
};
},
computed: {
serviceZipLinkText() {
if (this.modelValue.zipCode && this.modelValue.zipCode.length > 0) {