Makes value set the initial value of inputs
This commit is contained in:
parent
6954b45867
commit
778d6b8731
2
dist/formulate.esm.js
vendored
2
dist/formulate.esm.js
vendored
@ -1272,7 +1272,7 @@ var script = {
|
||||
*/
|
||||
defaultId: nanoid(9),
|
||||
localAttributes: {},
|
||||
internalModelProxy: this.formulateValue,
|
||||
internalModelProxy: this.formulateValue || this.value,
|
||||
behavioralErrorVisibility: (this.errorBehavior === 'live'),
|
||||
formShouldShowErrors: false,
|
||||
validationErrors: [],
|
||||
|
2
dist/formulate.min.js
vendored
2
dist/formulate.min.js
vendored
@ -1275,7 +1275,7 @@ var Formulate = (function (exports, isUrl, nanoid, isPlainObject) {
|
||||
*/
|
||||
defaultId: nanoid(9),
|
||||
localAttributes: {},
|
||||
internalModelProxy: this.formulateValue,
|
||||
internalModelProxy: this.formulateValue || this.value,
|
||||
behavioralErrorVisibility: (this.errorBehavior === 'live'),
|
||||
formShouldShowErrors: false,
|
||||
validationErrors: [],
|
||||
|
2
dist/formulate.umd.js
vendored
2
dist/formulate.umd.js
vendored
@ -1278,7 +1278,7 @@
|
||||
*/
|
||||
defaultId: nanoid(9),
|
||||
localAttributes: {},
|
||||
internalModelProxy: this.formulateValue,
|
||||
internalModelProxy: this.formulateValue || this.value,
|
||||
behavioralErrorVisibility: (this.errorBehavior === 'live'),
|
||||
formShouldShowErrors: false,
|
||||
validationErrors: [],
|
||||
|
@ -5,7 +5,6 @@
|
||||
"main": "dist/formulate.umd.js",
|
||||
"module": "dist/formulate.esm.js",
|
||||
"unpkg": "dist/formulate.min.js",
|
||||
"private": true,
|
||||
"engines": {
|
||||
"node": ">=11"
|
||||
},
|
||||
|
@ -170,7 +170,7 @@ export default {
|
||||
*/
|
||||
defaultId: nanoid(9),
|
||||
localAttributes: {},
|
||||
internalModelProxy: this.formulateValue,
|
||||
internalModelProxy: this.formulateValue || this.value,
|
||||
behavioralErrorVisibility: (this.errorBehavior === 'live'),
|
||||
formShouldShowErrors: false,
|
||||
validationErrors: [],
|
||||
|
@ -143,6 +143,16 @@ describe('FormulateInputText', () => {
|
||||
expect(wrapper.find('input').element.value).toBe('initial val')
|
||||
})
|
||||
|
||||
it('uses the value as the initial value', () => {
|
||||
const wrapper = mount(FormulateInput, { propsData: { type: 'text', value: 'initial val' } })
|
||||
expect(wrapper.find('input').element.value).toBe('initial val')
|
||||
})
|
||||
|
||||
it('uses the v-model value as the initial value when value prop is provided', () => {
|
||||
const wrapper = mount(FormulateInput, { propsData: { type: 'text', formulateValue: 'initial val', value: 'initial other val' } })
|
||||
expect(wrapper.find('input').element.value).toBe('initial val')
|
||||
})
|
||||
|
||||
it('uses a proxy model internally if it doesnt have a v-model', () => {
|
||||
const wrapper = mount(FormulateInput, { propsData: { type: 'textarea' } })
|
||||
const input = wrapper.find('textarea')
|
||||
|
Loading…
x
Reference in New Issue
Block a user