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 11{
22 "name" : " vue-formly-bootstrap" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "description" : " A bootstrap based form input bundle for Vue Formly" ,
55 "main" : " dist/vue-formly-bootstrap.js" ,
66 "scripts" : {
Original file line number Diff line number Diff line change 11<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} " >
33 <label v-if =" form[key].label" :for =" form[key].id ? form[key].id : null" >{{form[key].label}}</label >
44 <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 >
Original file line number Diff line number Diff line change @@ -201,6 +201,23 @@ describe('Bootstrap Field Inputs', () => {
201201
202202 } ) ;
203203
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+
204221 it ( 'defaults to text' , ( ) => {
205222 data . form . test . type = 'input' ;
206223 data . form . test . inputType = '' ;
You can’t perform that action at this time.
0 commit comments