Moved 'useForm' into modal component
This commit is contained in:
parent
9fa85f6295
commit
eb87accfb7
4 changed files with 7 additions and 15 deletions
|
|
@ -1,10 +1,14 @@
|
||||||
import { shallowMount } from "@vue/test-utils";
|
import { shallowMount } from "@vue/test-utils";
|
||||||
import Modal from "./modal";
|
import Modal from "./modal";
|
||||||
|
import crypto from "crypto";
|
||||||
|
import { useForm } from "vee-validate";
|
||||||
|
|
||||||
const modalId = "modal-one";
|
const modalId = "modal-one";
|
||||||
const footerButtonText = "Sample footer text here.";
|
const footerButtonText = "Sample footer text here.";
|
||||||
const headerText = "Sample header text here.";
|
const headerText = "Sample header text here.";
|
||||||
|
|
||||||
|
global.crypto = crypto;
|
||||||
|
|
||||||
describe("modal.vue", () => {
|
describe("modal.vue", () => {
|
||||||
it("Should display footer button text when footerButtonText is defined", async () => {
|
it("Should display footer button text when footerButtonText is defined", async () => {
|
||||||
const wrapper = shallowMount(Modal, {
|
const wrapper = shallowMount(Modal, {
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
<script>
|
<script>
|
||||||
import buttonMain from "@/ux-components/button-main/button-main";
|
import buttonMain from "@/ux-components/button-main/button-main";
|
||||||
import { Modal } from "bootstrap";
|
import { Modal } from "bootstrap";
|
||||||
import { useIsFormTouched, useIsFormDirty, useIsFormValid } from "vee-validate";
|
import { useForm, useIsFormTouched, useIsFormDirty, useIsFormValid } from "vee-validate";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "modal",
|
name: "modal",
|
||||||
|
|
@ -60,12 +60,14 @@ export default {
|
||||||
setup() {
|
setup() {
|
||||||
const modalId = `modal-${crypto.randomUUID()}`;
|
const modalId = `modal-${crypto.randomUUID()}`;
|
||||||
|
|
||||||
|
const modalForm = useForm();
|
||||||
const isTouched = useIsFormTouched();
|
const isTouched = useIsFormTouched();
|
||||||
const isDirty = useIsFormDirty();
|
const isDirty = useIsFormDirty();
|
||||||
const isValid = useIsFormValid();
|
const isValid = useIsFormValid();
|
||||||
|
|
||||||
return {
|
return {
|
||||||
modalId,
|
modalId,
|
||||||
|
modalForm,
|
||||||
isTouched,
|
isTouched,
|
||||||
isDirty,
|
isDirty,
|
||||||
isValid,
|
isValid,
|
||||||
|
|
|
||||||
|
|
@ -68,13 +68,6 @@ export default {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setup() {
|
|
||||||
const modalForm = useForm();
|
|
||||||
|
|
||||||
return {
|
|
||||||
modalForm,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
props: {
|
props: {
|
||||||
modelValue: {
|
modelValue: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|
|
||||||
|
|
@ -71,13 +71,6 @@ export default {
|
||||||
textboxQuestionWidgetName: String,
|
textboxQuestionWidgetName: String,
|
||||||
alertInvalidZipWidgetName: String,
|
alertInvalidZipWidgetName: String,
|
||||||
},
|
},
|
||||||
setup() {
|
|
||||||
const modalForm = useForm();
|
|
||||||
|
|
||||||
return {
|
|
||||||
modalForm,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
computed: {
|
computed: {
|
||||||
serviceZipLinkText() {
|
serviceZipLinkText() {
|
||||||
if (this.modelValue.zipCode && this.modelValue.zipCode.length > 0) {
|
if (this.modelValue.zipCode && this.modelValue.zipCode.length > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue