File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " vue-formly-bootstrap" ,
3
- "version" : " 1.0.0 " ,
3
+ "version" : " 1.0.1 " ,
4
4
"description" : " A bootstrap based form input bundle for Vue Formly" ,
5
5
"main" : " dist/vue-formly-bootstrap.js" ,
6
6
"scripts" : {
Original file line number Diff line number Diff line change 1
1
<template >
2
- <div class =" form-group" >
2
+ <div class =" form-group formly-input " :class = " {'formly-has-value': form[key].value, 'formly-has-focus': form[key].$active} " >
3
3
<label v-if =" form[key].label" :for =" form[key].id ? form[key].id : null" >{{form[key].label}}</label >
4
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" >
5
5
</div >
Original file line number Diff line number Diff line change @@ -201,6 +201,23 @@ describe('Bootstrap Field Inputs', () => {
201
201
202
202
} ) ;
203
203
204
+ it ( 'adds active and focus classes' , ( done ) => {
205
+ data . form . test . type = 'input' ;
206
+ data . form . test . inputType = 'text' ;
207
+ createForm ( data ) ;
208
+
209
+ expect ( vm . $el . querySelectorAll ( '.formly-has-focus' ) ) . to . be . length ( 0 ) ;
210
+ expect ( vm . $el . querySelectorAll ( '.formly-has-value' ) ) . to . be . length ( 0 ) ;
211
+
212
+ trigger ( vm . $el . querySelectorAll ( 'input' ) [ 0 ] , 'focus' ) ;
213
+ data . form . test . value = 'test' ;
214
+ setTimeout ( ( ) => {
215
+ expect ( vm . $el . querySelectorAll ( '.formly-has-focus' ) ) . to . be . length ( 1 ) ;
216
+ expect ( vm . $el . querySelectorAll ( '.formly-has-value' ) ) . to . be . length ( 1 ) ;
217
+ done ( ) ;
218
+ } , 0 ) ;
219
+ } ) ;
220
+
204
221
it ( 'defaults to text' , ( ) => {
205
222
data . form . test . type = 'input' ;
206
223
data . form . test . inputType = '' ;
You can’t perform that action at this time.
0 commit comments