diff --git a/dist/formulate.esm.js b/dist/formulate.esm.js index de49d67..372206b 100644 --- a/dist/formulate.esm.js +++ b/dist/formulate.esm.js @@ -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: [], diff --git a/dist/formulate.min.js b/dist/formulate.min.js index 32da806..49d16ee 100644 --- a/dist/formulate.min.js +++ b/dist/formulate.min.js @@ -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: [], diff --git a/dist/formulate.umd.js b/dist/formulate.umd.js index b5a1dc0..f9cbc56 100644 --- a/dist/formulate.umd.js +++ b/dist/formulate.umd.js @@ -1278,7 +1278,7 @@ */ defaultId: nanoid(9), localAttributes: {}, - internalModelProxy: this.formulateValue, + internalModelProxy: this.formulateValue || this.value, behavioralErrorVisibility: (this.errorBehavior === 'live'), formShouldShowErrors: false, validationErrors: [], diff --git a/package.json b/package.json index e36b295..060a5f0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,6 @@ "main": "dist/formulate.umd.js", "module": "dist/formulate.esm.js", "unpkg": "dist/formulate.min.js", - "private": true, "engines": { "node": ">=11" }, diff --git a/src/FormulateInput.vue b/src/FormulateInput.vue index 13d4841..712f058 100644 --- a/src/FormulateInput.vue +++ b/src/FormulateInput.vue @@ -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: [], diff --git a/test/FormulateInputText.test.js b/test/FormulateInputText.test.js index b8b1baf..e2ec886 100644 --- a/test/FormulateInputText.test.js +++ b/test/FormulateInputText.test.js @@ -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')