import Vue from 'vue' import { mount } from '@vue/test-utils' import flushPromises from 'flush-promises' import FormSubmission from '@/FormSubmission.ts' import Formulario from '@/index.ts' import FormularioForm from '@/FormularioForm.vue' function validationMessages (instance) { instance.extend({ validationMessages: { required: () => 'required', 'in': () => 'in', min: () => 'min', } }) } Vue.use(Formulario, { plugins: [validationMessages] }) describe('FormularioForm', () => { it('render a form DOM element', () => { const wrapper = mount(FormularioForm) expect(wrapper.find('form').exists()).toBe(true) }) it('accepts a default slot', () => { const wrapper = mount(FormularioForm, { slots: { default: '
' } }) expect(wrapper.find('form div.default-slot-item').exists()).toBe(true) }) it('intercepts submit event', () => { const formSubmitted = jest.fn() const wrapper = mount(FormularioForm, { slots: { default: "