Ensure sparse arrays are treated as dense by _.keys and _.keysIn and ensure support for string objects in _.keys and _.keysIn.

This commit is contained in:
John-David Dalton
2014-03-25 09:26:20 -07:00
parent 0ab5d6a7b8
commit c721721fc5
3 changed files with 37 additions and 16 deletions

View File

@@ -5091,10 +5091,10 @@
deepEqual(_.keys(object), ['a', 'b']);
});
test('should work with sparse arrays', 1, function() {
test('should treat sparse arrays as dense', 1, function() {
var array = [1];
array[2] = 3;
deepEqual(_.keys(array), ['0', '2']);
deepEqual(_.keys(array), ['0', '1', '2']);
});
test('should work with `arguments` objects (test in IE < 9)', 1, function() {

View File

@@ -82,6 +82,9 @@
'isEqual': [
'Died on test #60',
'Died on test #63'
],
'keys': [
'is not fooled by sparse arrays; see issue #95'
]
},
'Utility': {
@@ -122,6 +125,7 @@
}
delete QUnit.config.excused.Chaining;
delete QUnit.config.excused.Collections.where;
delete QUnit.config.excused.Objects.keys;
delete QUnit.config.excused.Utility['_.escape'];
delete QUnit.config.excused.Utility['_.unescape'];
}