@@ -322,9 +322,7 @@ describe('component props', () => {
322
322
} )
323
323
324
324
test ( 'warn on type mismatch' , ( ) => {
325
- class MyClass {
326
-
327
- }
325
+ class MyClass { }
328
326
const Comp = {
329
327
props : {
330
328
bool : { type : Boolean } ,
@@ -333,28 +331,45 @@ describe('component props', () => {
333
331
arr : { type : Array } ,
334
332
obj : { type : Object } ,
335
333
cls : { type : MyClass } ,
336
- fn : { type : Function } ,
334
+ fn : { type : Function }
337
335
} ,
338
336
setup ( ) {
339
337
return ( ) => null
340
338
}
341
339
}
342
- render ( h ( Comp , {
340
+ render (
341
+ h ( Comp , {
343
342
bool : 'true' ,
344
343
str : 100 ,
345
344
num : '100' ,
346
345
arr : { } ,
347
346
obj : 'false' ,
348
347
cls : { } ,
349
- fn : true ,
350
- } ) , nodeOps . createElement ( 'div' ) )
351
- expect ( `Invalid prop: type check failed for prop "bool". Expected Boolean, got String` ) . toHaveBeenWarned ( )
352
- expect ( `Invalid prop: type check failed for prop "str". Expected String with value "100", got Number with value 100.` ) . toHaveBeenWarned ( )
353
- expect ( `Invalid prop: type check failed for prop "num". Expected Number with value 100, got String with value "100".` ) . toHaveBeenWarned ( )
354
- expect ( `Invalid prop: type check failed for prop "arr". Expected Array, got Object` ) . toHaveBeenWarned ( )
355
- expect ( `Invalid prop: type check failed for prop "obj". Expected Object, got String with value "false"` ) . toHaveBeenWarned ( )
356
- expect ( `Invalid prop: type check failed for prop "fn". Expected Function, got Boolean with value true.` ) . toHaveBeenWarned ( )
357
- expect ( `Invalid prop: type check failed for prop "cls". Expected MyClass, got Object` ) . toHaveBeenWarned ( )
348
+ fn : true
349
+ } ) ,
350
+ nodeOps . createElement ( 'div' )
351
+ )
352
+ expect (
353
+ `Invalid prop: type check failed for prop "bool". Expected Boolean, got String`
354
+ ) . toHaveBeenWarned ( )
355
+ expect (
356
+ `Invalid prop: type check failed for prop "str". Expected String with value "100", got Number with value 100.`
357
+ ) . toHaveBeenWarned ( )
358
+ expect (
359
+ `Invalid prop: type check failed for prop "num". Expected Number with value 100, got String with value "100".`
360
+ ) . toHaveBeenWarned ( )
361
+ expect (
362
+ `Invalid prop: type check failed for prop "arr". Expected Array, got Object`
363
+ ) . toHaveBeenWarned ( )
364
+ expect (
365
+ `Invalid prop: type check failed for prop "obj". Expected Object, got String with value "false"`
366
+ ) . toHaveBeenWarned ( )
367
+ expect (
368
+ `Invalid prop: type check failed for prop "fn". Expected Function, got Boolean with value true.`
369
+ ) . toHaveBeenWarned ( )
370
+ expect (
371
+ `Invalid prop: type check failed for prop "cls". Expected MyClass, got Object`
372
+ ) . toHaveBeenWarned ( )
358
373
} )
359
374
360
375
// #3495
0 commit comments