@@ -154,7 +154,8 @@ if (_.inBrowser) {
154154 'multiple-attrs' ,
155155 'oneway' ,
156156 'with-filter' ,
157- 'camelCase'
157+ 'camelCase' ,
158+ 'boolean-literal'
158159 ]
159160 } )
160161 var def = Vue . options . directives . _prop
@@ -164,11 +165,12 @@ if (_.inBrowser) {
164165 el . setAttribute ( 'multiple-attrs' , 'a {{b}} c' )
165166 el . setAttribute ( 'oneway' , '{{*a}}' )
166167 el . setAttribute ( 'with-filter' , '{{a | filter}}' )
168+ el . setAttribute ( 'boolean-literal' , '{{true}}' )
167169 transclude ( el , options )
168170 var linker = compile ( el , options )
169171 linker ( vm , el )
170172 // should skip literals and one-time bindings
171- expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 4 )
173+ expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 5 )
172174 // data-some-attr
173175 var args = vm . _bindDir . calls . argsFor ( 0 )
174176 expect ( args [ 0 ] ) . toBe ( 'prop' )
@@ -198,11 +200,19 @@ if (_.inBrowser) {
198200 expect ( args [ 2 ] . arg ) . toBe ( 'withFilter' )
199201 expect ( args [ 2 ] . expression ) . toBe ( 'this._applyFilters(a,null,[{"name":"filter"}],false)' )
200202 expect ( args [ 3 ] ) . toBe ( def )
203+ // boolean-literal
204+ args = vm . _bindDir . calls . argsFor ( 4 )
205+ expect ( args [ 0 ] ) . toBe ( 'prop' )
206+ expect ( args [ 1 ] ) . toBe ( null )
207+ expect ( args [ 2 ] . arg ) . toBe ( 'booleanLiteral' )
208+ expect ( args [ 2 ] . expression ) . toBe ( 'true' )
209+ expect ( args [ 2 ] . oneWay ) . toBe ( true )
201210 // camelCase should've warn
202211 expect ( hasWarned ( _ , 'using camelCase' ) ) . toBe ( true )
203212 // literal and one time should've called vm.$set
204- expect ( vm . $set ) . toHaveBeenCalledWith ( 'a' , '1' )
205- expect ( vm . $set ) . toHaveBeenCalledWith ( 'someOtherAttr' , '2' )
213+ // and numbers should be casted
214+ expect ( vm . $set ) . toHaveBeenCalledWith ( 'a' , 1 )
215+ expect ( vm . $set ) . toHaveBeenCalledWith ( 'someOtherAttr' , 2 )
206216 } )
207217
208218 it ( 'props on root instance' , function ( ) {
0 commit comments