@@ -295,7 +295,7 @@ describe('prop', function () {
295
295
296
296
describe ( 'assertions' , function ( ) {
297
297
298
- function makeInstance ( value , type , validator ) {
298
+ function makeInstance ( value , type , validator , coerce ) {
299
299
return new Vue ( {
300
300
el : document . createElement ( 'div' ) ,
301
301
template : '<test :test="val"></test>' ,
@@ -307,7 +307,8 @@ describe('prop', function () {
307
307
props : {
308
308
test : {
309
309
type : type ,
310
- validator : validator
310
+ validator : validator ,
311
+ coerce : coerce
311
312
}
312
313
}
313
314
}
@@ -391,6 +392,17 @@ describe('prop', function () {
391
392
expect ( hasWarned ( 'Expected String' ) ) . toBe ( true )
392
393
} )
393
394
395
+ it ( 'type check + coerce' , function ( ) {
396
+ makeInstance ( 123 , String , null , String )
397
+ expect ( getWarnCount ( ) ) . toBe ( 0 )
398
+ makeInstance ( '123' , Number , null , Number )
399
+ expect ( getWarnCount ( ) ) . toBe ( 0 )
400
+ makeInstance ( '123' , Boolean , null , function ( val ) {
401
+ return val === '123'
402
+ } )
403
+ expect ( getWarnCount ( ) ) . toBe ( 0 )
404
+ } )
405
+
394
406
it ( 'required' , function ( ) {
395
407
new Vue ( {
396
408
el : document . createElement ( 'div' ) ,
0 commit comments