File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -428,6 +428,32 @@ describe('Filter: filter', function() {
428
428
} ) ;
429
429
430
430
431
+ it ( 'should not throw an error if property is null when comparing object' , function ( ) {
432
+ var items = [
433
+ { office :1 , people : { name :'john' } } ,
434
+ { office :2 , people : { name :'jane' } } ,
435
+ { office :3 , people : null }
436
+ ] ;
437
+ var f = { } ;
438
+ expect ( filter ( items , f ) . length ) . toBe ( 3 ) ;
439
+
440
+ f = { people :null } ;
441
+ expect ( filter ( items , f ) . length ) . toBe ( 3 ) ;
442
+
443
+ //should throw an error in 1.3.12
444
+ f = { people :{ name :'john' } } ;
445
+ expect ( filter ( items , f ) . length ) . toBe ( 1 ) ;
446
+
447
+ //should throw an error in 1.3.12
448
+ f = { people :{ name :'j' } } ;
449
+ expect ( filter ( items , f ) . length ) . toBe ( 2 ) ;
450
+
451
+ //should throw an error in 1.3.12
452
+ f = { people :{ name : '' } } ;
453
+ expect ( filter ( items , f ) . length ) . toBe ( 2 ) ;
454
+
455
+ } ) ;
456
+
431
457
describe ( 'should support comparator' , function ( ) {
432
458
433
459
it ( 'not consider `object === "[object Object]"` in non-strict comparison' , function ( ) {
You can’t perform that action at this time.
0 commit comments