@@ -322,9 +322,7 @@ describe('component props', () => {
322322 } )
323323
324324 test ( 'warn on type mismatch' , ( ) => {
325- class MyClass {
326-
327- }
325+ class MyClass { }
328326 const Comp = {
329327 props : {
330328 bool : { type : Boolean } ,
@@ -333,28 +331,45 @@ describe('component props', () => {
333331 arr : { type : Array } ,
334332 obj : { type : Object } ,
335333 cls : { type : MyClass } ,
336- fn : { type : Function } ,
334+ fn : { type : Function }
337335 } ,
338336 setup ( ) {
339337 return ( ) => null
340338 }
341339 }
342- render ( h ( Comp , {
340+ render (
341+ h ( Comp , {
343342 bool : 'true' ,
344343 str : 100 ,
345344 num : '100' ,
346345 arr : { } ,
347346 obj : 'false' ,
348347 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 ( )
358373 } )
359374
360375 // #3495
0 commit comments