chore: Added changes from master
This commit is contained in:
parent
049e90a128
commit
bd53602f5e
@ -303,8 +303,10 @@ export default class FormularioInput extends Vue {
|
|||||||
this.addErrorObserver({ callback: this.setErrors, type: 'input', field: this.nameOrFallback })
|
this.addErrorObserver({ callback: this.setErrors, type: 'input', field: this.nameOrFallback })
|
||||||
}
|
}
|
||||||
this.updateLocalAttributes(this.$attrs)
|
this.updateLocalAttributes(this.$attrs)
|
||||||
|
if (this.errorBehavior === ERROR_BEHAVIOR.LIVE) {
|
||||||
this.performValidation()
|
this.performValidation()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// noinspection JSUnusedGlobalSymbols
|
// noinspection JSUnusedGlobalSymbols
|
||||||
beforeDestroy (): void {
|
beforeDestroy (): void {
|
||||||
|
@ -31,6 +31,14 @@ export function shallowEqualObjects (objA: Record<string, any>, objB: Record<str
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (objA instanceof Date && objB instanceof Date) {
|
||||||
|
return objA.getTime() === objB.getTime()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (aKeys.length === 0) {
|
||||||
|
return objA === objB
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < aKeys.length; i++) {
|
for (let i = 0; i < aKeys.length; i++) {
|
||||||
const key = aKeys[i]
|
const key = aKeys[i]
|
||||||
|
|
||||||
|
@ -160,8 +160,6 @@ describe('FormularioForm', () => {
|
|||||||
expect(wrapper.find('span').text()).toBe('234')
|
expect(wrapper.find('span').text()).toBe('234')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
/**
|
/**
|
||||||
* @todo in vue-test-utils version 1.0.0-beta.29 has some bugs related to
|
* @todo in vue-test-utils version 1.0.0-beta.29 has some bugs related to
|
||||||
|
@ -75,6 +75,22 @@ describe('FormularioInput', () => {
|
|||||||
expect(wrapper.find('span').text()).toBe('The string other value is not correct.')
|
expect(wrapper.find('span').text()).toBe('The string other value is not correct.')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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('uses custom async validation rules on defined on the field', async () => {
|
it('uses custom async validation rules on defined on the field', async () => {
|
||||||
const wrapper = mount(FormularioInput, {
|
const wrapper = mount(FormularioInput, {
|
||||||
propsData: {
|
propsData: {
|
||||||
@ -282,12 +298,13 @@ describe('FormularioInput', () => {
|
|||||||
`
|
`
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
await flushPromises()
|
await flushPromises()
|
||||||
expect(wrapper.find('span').exists()).toBe(false)
|
expect(wrapper.find('span').exists()).toBe(false)
|
||||||
|
|
||||||
wrapper.trigger('submit')
|
wrapper.trigger('submit')
|
||||||
await flushPromises()
|
|
||||||
|
|
||||||
|
await flushPromises()
|
||||||
expect(wrapper.find('span').exists()).toBe(true)
|
expect(wrapper.find('span').exists()).toBe(true)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user