mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 18:37:50 +00:00
Remove unnecessary defineProperty guards.
This commit is contained in:
79
test/test.js
79
test/test.js
@@ -7025,23 +7025,18 @@
|
|||||||
assert.expect(4);
|
assert.expect(4);
|
||||||
|
|
||||||
lodashStable.each(['a', ['a'], { 'a': 1 }, NaN], function(value) {
|
lodashStable.each(['a', ['a'], { 'a': 1 }, NaN], function(value) {
|
||||||
if (defineProperty) {
|
var object = {},
|
||||||
var object = {},
|
pass = true;
|
||||||
pass = true;
|
|
||||||
|
|
||||||
defineProperty(object, 'a', {
|
defineProperty(object, 'a', {
|
||||||
'enumerable': true,
|
'enumerable': true,
|
||||||
'configurable': true,
|
'configurable': true,
|
||||||
'get': lodashStable.constant(value),
|
'get': lodashStable.constant(value),
|
||||||
'set': function() { pass = false; }
|
'set': function() { pass = false; }
|
||||||
});
|
});
|
||||||
|
|
||||||
func(object, { 'a': value });
|
func(object, { 'a': value });
|
||||||
assert.ok(pass);
|
assert.ok(pass);
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -15196,23 +15191,18 @@
|
|||||||
QUnit.test('should skip merging when `object` and `source` are the same value', function(assert) {
|
QUnit.test('should skip merging when `object` and `source` are the same value', function(assert) {
|
||||||
assert.expect(1);
|
assert.expect(1);
|
||||||
|
|
||||||
if (defineProperty) {
|
var object = {},
|
||||||
var object = {},
|
pass = true;
|
||||||
pass = true;
|
|
||||||
|
|
||||||
defineProperty(object, 'a', {
|
defineProperty(object, 'a', {
|
||||||
'enumerable': true,
|
'enumerable': true,
|
||||||
'configurable': true,
|
'configurable': true,
|
||||||
'get': function() { pass = false; },
|
'get': function() { pass = false; },
|
||||||
'set': function() { pass = false; }
|
'set': function() { pass = false; }
|
||||||
});
|
});
|
||||||
|
|
||||||
_.merge(object, object);
|
_.merge(object, object);
|
||||||
assert.ok(pass);
|
assert.ok(pass);
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('should convert values to arrays when merging arrays of `source`', function(assert) {
|
QUnit.test('should convert values to arrays when merging arrays of `source`', function(assert) {
|
||||||
@@ -20081,24 +20071,19 @@
|
|||||||
assert.expect(4);
|
assert.expect(4);
|
||||||
|
|
||||||
lodashStable.each(['a', ['a'], { 'a': 1 }, NaN], function(value) {
|
lodashStable.each(['a', ['a'], { 'a': 1 }, NaN], function(value) {
|
||||||
if (defineProperty) {
|
var object = {},
|
||||||
var object = {},
|
pass = true,
|
||||||
pass = true,
|
updater = isUpdate ? lodashStable.constant(value) : value;
|
||||||
updater = isUpdate ? lodashStable.constant(value) : value;
|
|
||||||
|
|
||||||
defineProperty(object, 'a', {
|
defineProperty(object, 'a', {
|
||||||
'enumerable': true,
|
'enumerable': true,
|
||||||
'configurable': true,
|
'configurable': true,
|
||||||
'get': lodashStable.constant(value),
|
'get': lodashStable.constant(value),
|
||||||
'set': function() { pass = false; }
|
'set': function() { pass = false; }
|
||||||
});
|
});
|
||||||
|
|
||||||
func(object, 'a', updater);
|
func(object, 'a', updater);
|
||||||
assert.ok(pass);
|
assert.ok(pass);
|
||||||
}
|
|
||||||
else {
|
|
||||||
skipAssert(assert);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -24906,7 +24891,7 @@
|
|||||||
|
|
||||||
var object = {};
|
var object = {};
|
||||||
|
|
||||||
if (!isStrict && defineProperty) {
|
if (!isStrict) {
|
||||||
defineProperty(object, 'a', {
|
defineProperty(object, 'a', {
|
||||||
'configurable': false,
|
'configurable': false,
|
||||||
'enumerable': true,
|
'enumerable': true,
|
||||||
|
|||||||
Reference in New Issue
Block a user