Skip to content

Commit ccb7dbd

Browse files
committed
added default to input
1 parent dea4a16 commit ccb7dbd

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/fields/fieldInput.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="form-group">
33
<label v-if="form[key].label" :for="form[key].id ? form[key].id : null">{{form[key].label}}</label>
4-
<input class="form-control" :class="form[key].classes" :id="form[key].id ? form[key].id : null" :type="form[key].inputType" v-model="form[key].value" @blur="onBlur" @focus="onFocus" @click="onClick" @change="onChange" @keyup="onKeyup" @keydown="onKeydown" v-formly-atts="form[key].atts">
4+
<input class="form-control" :class="form[key].classes" :id="form[key].id ? form[key].id : null" :type="form[key].inputType || text" v-model="form[key].value" @blur="onBlur" @focus="onFocus" @click="onClick" @change="onChange" @keyup="onKeyup" @keydown="onKeydown" v-formly-atts="form[key].atts">
55
</div>
66
</template>
77

test/unit/specs/index.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,16 @@ describe('Bootstrap Field Inputs', () => {
199199
}, 0);
200200

201201
});
202+
203+
it('defaults to text', () => {
204+
data.form.test.type = 'input';
205+
data.form.test.inputType = '';
206+
createForm(data);
207+
208+
let inputs = vm.$el.querySelectorAll('input');
209+
let input = inputs[0];
210+
expect(input.type).to.equal('text');
211+
});
202212
});
203213

204214

0 commit comments

Comments
 (0)