@@ -154,7 +154,8 @@ if (_.inBrowser) {
154
154
'multiple-attrs' ,
155
155
'oneway' ,
156
156
'with-filter' ,
157
- 'camelCase'
157
+ 'camelCase' ,
158
+ 'boolean-literal'
158
159
]
159
160
} )
160
161
var def = Vue . options . directives . _prop
@@ -164,11 +165,12 @@ if (_.inBrowser) {
164
165
el . setAttribute ( 'multiple-attrs' , 'a {{b}} c' )
165
166
el . setAttribute ( 'oneway' , '{{*a}}' )
166
167
el . setAttribute ( 'with-filter' , '{{a | filter}}' )
168
+ el . setAttribute ( 'boolean-literal' , '{{true}}' )
167
169
transclude ( el , options )
168
170
var linker = compile ( el , options )
169
171
linker ( vm , el )
170
172
// should skip literals and one-time bindings
171
- expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 4 )
173
+ expect ( vm . _bindDir . calls . count ( ) ) . toBe ( 5 )
172
174
// data-some-attr
173
175
var args = vm . _bindDir . calls . argsFor ( 0 )
174
176
expect ( args [ 0 ] ) . toBe ( 'prop' )
@@ -198,11 +200,19 @@ if (_.inBrowser) {
198
200
expect ( args [ 2 ] . arg ) . toBe ( 'withFilter' )
199
201
expect ( args [ 2 ] . expression ) . toBe ( 'this._applyFilters(a,null,[{"name":"filter"}],false)' )
200
202
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 )
201
210
// camelCase should've warn
202
211
expect ( hasWarned ( _ , 'using camelCase' ) ) . toBe ( true )
203
212
// 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 )
206
216
} )
207
217
208
218
it ( 'props on root instance' , function ( ) {
0 commit comments