Removed field validation on created when errorBehavior is not live.
This commit is contained in:
parent
66494bdd29
commit
ef285012fa
@ -183,7 +183,9 @@ export default {
|
||||
this.observeErrors({ callback: this.setErrors, type: 'input', field: this.nameOrFallback })
|
||||
}
|
||||
this.updateLocalAttributes(this.$attrs)
|
||||
this.performValidation()
|
||||
if (this.errorBehavior === 'live') {
|
||||
this.performValidation()
|
||||
}
|
||||
},
|
||||
beforeDestroy () {
|
||||
if (!this.disableErrors && typeof this.removeErrorObserver === 'function') {
|
||||
|
@ -44,6 +44,22 @@ describe('FormularioInput', () => {
|
||||
expect(wrapper.find('span').text()).toBe('the value was different than expected')
|
||||
})
|
||||
|
||||
it('no validation on created when errorBehavior is not live', async () => {
|
||||
const wrapper = mount(FormularioInput, {
|
||||
propsData: {
|
||||
name: 'test',
|
||||
validation: 'required|in:abcdef',
|
||||
validationMessages: {in: 'the value was different than expected'},
|
||||
value: 'other value'
|
||||
},
|
||||
scopedSlots: {
|
||||
default: `<div><span v-for="error in props.context.allErrors">{{ error.message }}</span></div>`
|
||||
}
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.find('span').exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('allows custom field-rule level validation functions', async () => {
|
||||
const wrapper = mount(FormularioInput, {
|
||||
propsData: {
|
||||
@ -268,6 +284,9 @@ describe('FormularioInput', () => {
|
||||
`
|
||||
}
|
||||
})
|
||||
await flushPromises()
|
||||
expect(wrapper.find('span').exists()).toBe(false)
|
||||
|
||||
wrapper.trigger('submit')
|
||||
await flushPromises()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user