From 3cc80f20da68c6493804577e4b51a2034238d394 Mon Sep 17 00:00:00 2001 From: Zaytsev Kirill Date: Mon, 26 Oct 2020 00:51:19 +0300 Subject: [PATCH] test: Removed checks for allErrors prop, replaced with checks for particular errors & violations --- test/unit/FormularioForm.test.js | 2 +- test/unit/FormularioGrouping.test.js | 2 +- test/unit/FormularioInput.test.js | 37 ++++------------------------ 3 files changed, 7 insertions(+), 34 deletions(-) diff --git a/test/unit/FormularioForm.test.js b/test/unit/FormularioForm.test.js index 1832e99..8d1327d 100644 --- a/test/unit/FormularioForm.test.js +++ b/test/unit/FormularioForm.test.js @@ -251,7 +251,7 @@ describe('FormularioForm', () => { slots: { default: ` - {{ error.message }} + {{ error }} ` } diff --git a/test/unit/FormularioGrouping.test.js b/test/unit/FormularioGrouping.test.js index 7cb2818..2bb5424 100644 --- a/test/unit/FormularioGrouping.test.js +++ b/test/unit/FormularioGrouping.test.js @@ -86,7 +86,7 @@ describe('FormularioGrouping', () => { default: ` - {{ error }} + {{ error }} `, diff --git a/test/unit/FormularioInput.test.js b/test/unit/FormularioInput.test.js index f8eb6bd..9475ad3 100644 --- a/test/unit/FormularioInput.test.js +++ b/test/unit/FormularioInput.test.js @@ -108,7 +108,7 @@ describe('FormularioInput', () => { value: 'other value' }, scopedSlots: { - default: `
{{ error.message }}
` + default: `
{{ error.message }}
` } }) await flushPromises() @@ -126,7 +126,7 @@ describe('FormularioInput', () => { value: 'bar' }, scopedSlots: { - default: `
{{ error.message }}
` + default: `
{{ error.message }}
` } }) await flushPromises() @@ -205,7 +205,7 @@ describe('FormularioInput', () => { name: 'test', validation: 'required|in:xyz|bail', validationBehavior: 'live', - } + }, }) await flushPromises(); expect(wrapper.vm.context.violations.length).toBe(2); @@ -248,45 +248,18 @@ describe('FormularioInput', () => { expect(wrapper.vm.context.violations.length).toBe(2); }) - it('Does not show errors on blur when set validation-behavior is submit', async () => { - const wrapper = mount(FormularioInput, { - propsData: { - name: 'test', - validation: 'required', - validationBehavior: 'submit', - }, - scopedSlots: { - default: ` -
- - {{ error.message }} -
- ` - } - }) - - expect(wrapper.find('span').exists()).toBe(false) - - wrapper.find('input').trigger('input') - wrapper.find('input').trigger('blur') - - await flushPromises() - - expect(wrapper.find('span').exists()).toBe(false) - }) - it('Displays errors when validation-behavior is submit and form is submitted', async () => { const wrapper = mount(FormularioForm, { propsData: { name: 'test' }, slots: { default: ` - {{ error.message }} + {{ error.message }} ` }