Ensure _.where deep compares properties values.

Former-commit-id: f3f29abf024f87a947fef6df1e3db9d9d1de99bf
This commit is contained in:
John-David Dalton
2013-01-22 23:54:09 -08:00
parent 288ac115d0
commit e41b181163
6 changed files with 120 additions and 111 deletions

View File

@@ -2353,6 +2353,15 @@
test('should return an empty array when passed an empty `properties` object', function() {
deepEqual(_.where(array, {}), []);
});
test('should deep compare `properties` values', function() {
var collection = [
{ 'a': { 'b': 1 }, 'c': 2 },
{ 'a': { 'b': 2 }, 'c': 3 }
];
deepEqual(_.where(collection, { 'a': { 'b': 1 } }), [{ 'a': { 'b': 1 }, 'c': 2 }]);
});
}());
/*--------------------------------------------------------------------------*/