fix(orderBy): make object-to-primtiive behaviour work for objects with null prototype

This commit is contained in:
Caitlin Potter
2014-12-03 13:34:49 -05:00
parent 8bfeddb5d6
commit 3aa5752894
2 changed files with 25 additions and 5 deletions

View File

@@ -115,6 +115,16 @@ describe('Filter: orderBy', function() {
];
expect(orderBy(array)).toEqualData(array);
});
it('should not reverse array of objects with null prototype and no predicate', function() {
var array = [2,1,4,3].map(function(id) {
var obj = Object.create(null);
obj.id = id;
return obj;
});
expect(orderBy(array)).toEqualData(array);
});
});
@@ -232,5 +242,15 @@ describe('Filter: orderBy', function() {
];
expect(orderBy(array)).toEqualData(array);
});
it('should not reverse array of objects with null prototype and no predicate', function() {
var array = [2,1,4,3].map(function(id) {
var obj = Object.create(null);
obj.id = id;
return obj;
});
expect(orderBy(array)).toEqualData(array);
});
});
});