test: Improved checking validation event & code style
This commit is contained in:
parent
cb2f350edf
commit
4cec18b1d7
@ -320,7 +320,7 @@ describe('FormularioForm', () => {
|
|||||||
expect(wrapper.vm.mergedFieldErrors.inputB.length).toBe(2)
|
expect(wrapper.vm.mergedFieldErrors.inputB.length).toBe(2)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Emits correct validation event when no errors', async () => {
|
it('emits correct validation event when no errors', async () => {
|
||||||
const wrapper = mount(FormularioForm, {
|
const wrapper = mount(FormularioForm, {
|
||||||
slots: {
|
slots: {
|
||||||
default: `
|
default: `
|
||||||
@ -337,11 +337,10 @@ describe('FormularioForm', () => {
|
|||||||
await flushPromises()
|
await flushPromises()
|
||||||
|
|
||||||
expect(wrapper.emitted('validation')).toBeTruthy()
|
expect(wrapper.emitted('validation')).toBeTruthy()
|
||||||
expect(wrapper.emitted('validation').length).toBe(1)
|
expect(wrapper.emitted('validation')).toEqual([[{
|
||||||
expect(wrapper.emitted('validation')[0][0]).toEqual({
|
|
||||||
name: 'foo',
|
name: 'foo',
|
||||||
violations: [],
|
violations: [],
|
||||||
})
|
}]])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Emits correct validation event on entry', async () => {
|
it('Emits correct validation event on entry', async () => {
|
||||||
|
@ -6,7 +6,7 @@ import Formulario from '@/index.ts'
|
|||||||
import FormularioForm from '@/FormularioForm.vue'
|
import FormularioForm from '@/FormularioForm.vue'
|
||||||
import FormularioInput from '@/FormularioInput.vue'
|
import FormularioInput from '@/FormularioInput.vue'
|
||||||
|
|
||||||
const globalRule = jest.fn(() => { return false })
|
const globalRule = jest.fn(() => false)
|
||||||
|
|
||||||
Vue.use(Formulario, {
|
Vue.use(Formulario, {
|
||||||
validationRules: { globalRule },
|
validationRules: { globalRule },
|
||||||
|
Loading…
Reference in New Issue
Block a user