File tree Expand file tree Collapse file tree 2 files changed +15
-3
lines changed
Expand file tree Collapse file tree 2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 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" :id =" form[key].id ? form[key].id : null" :type =" form[key].inputType" v-model =" form[key].value" :placeholder =" form[key].placeholder" @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" v-model =" form[key].value" :placeholder =" form[key].placeholder" @blur =" onBlur" @focus =" onFocus" @click =" onClick" @change =" onChange" @keyup =" onKeyup" @keydown =" onKeydown" v-formly-atts =" form[key].atts" >
55 </div >
66</template >
77
Original file line number Diff line number Diff line change @@ -108,8 +108,8 @@ describe('Bootstrap Field Inputs', () => {
108108
109109 } ) ;
110110
111- describe ( 'attributes' , ( ) => {
112- it ( 'should pass attributes' , ( ) => {
111+ describe ( 'classes & attributes' , ( ) => {
112+ it ( 'attributes' , ( ) => {
113113 data . form . test . type = 'input' ;
114114 data . form . test . inputType = 'text' ;
115115 data . form . test . atts = {
@@ -121,6 +121,18 @@ describe('Bootstrap Field Inputs', () => {
121121 expect ( input . dataset . foo ) . to . equal ( 'bar' ) ;
122122 expect ( input . dataset . bar ) . to . equal ( 'foo' ) ;
123123 } ) ;
124+
125+ it ( 'classes' , ( ) => {
126+ data . form . test . type = 'input' ;
127+ data . form . test . inputType = 'text' ;
128+ data . form . test . classes = {
129+ 'class-a' : true ,
130+ 'class-b' : false
131+ } ;
132+ createForm ( ) ;
133+ let input = vm . $el . querySelectorAll ( 'input' ) [ 0 ] ;
134+ expect ( input . className ) . to . equal ( 'form-control class-a' ) ;
135+ } ) ;
124136 } ) ;
125137
126138 describe ( 'input' , ( ) => {
You can’t perform that action at this time.
0 commit comments