mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-05 09:27:49 +00:00
Avoid a hasOwnProperty bug in IE 10-11 where objects with a [[Prototype]] of null incorrectly report false for own index properties.
This commit is contained in:
47
test/test.js
47
test/test.js
@@ -6341,17 +6341,7 @@
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should work with non-string `path` arguments', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var array = [1, 2, 3];
|
||||
|
||||
_.each([1, [1]], function(path) {
|
||||
assert.strictEqual(func(array, path), true);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should coerce key to a string', function(assert) {
|
||||
QUnit.test('`_.' + methodName + '` should coerce `path` to a string', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
function fn() {}
|
||||
@@ -6389,12 +6379,6 @@
|
||||
assert.strictEqual(func(Array(1), 0), true);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should work with `arguments` objects', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.strictEqual(func(args, 1), true);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should check for a key over a path', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
@@ -6444,6 +6428,35 @@
|
||||
assert.strictEqual(func(object, path), false);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should work with non-string `path` arguments', function(assert) {
|
||||
assert.expect(2);
|
||||
|
||||
var array = [1, 2, 3];
|
||||
|
||||
_.each([1, [1]], function(path) {
|
||||
assert.strictEqual(func(array, path), true);
|
||||
});
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should work with `arguments` objects', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
assert.strictEqual(func(args, 1), true);
|
||||
});
|
||||
|
||||
QUnit.test('`_.' + methodName + '` should work for objects with a `[[Prototype]]` of `null`', function(assert) {
|
||||
assert.expect(1);
|
||||
|
||||
if (create) {
|
||||
var object = create(null);
|
||||
object[1] = 'a';
|
||||
assert.strictEqual(func(object, 1), true);
|
||||
}
|
||||
else {
|
||||
skipTest(assert);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
Reference in New Issue
Block a user