mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Update vendor/underscore.
Former-commit-id: 8bb0b59d367ab2600a85a4442789eb41d9d97cb6
This commit is contained in:
20
vendor/underscore/test/objects.js
vendored
20
vendor/underscore/test/objects.js
vendored
@@ -56,8 +56,8 @@ $(document).ready(function() {
|
||||
|
||||
try {
|
||||
result = {};
|
||||
_.extend(result, null, undefined, { 'a': 1 });
|
||||
} catch(ex) { }
|
||||
_.extend(result, null, undefined, {a:1});
|
||||
} catch(ex) {}
|
||||
|
||||
equal(result.a, 1, 'should not error on `null` or `undefined` sources');
|
||||
});
|
||||
@@ -106,8 +106,8 @@ $(document).ready(function() {
|
||||
|
||||
try {
|
||||
options = {};
|
||||
_.defaults(options, null, undefined, { 'a': 1 });
|
||||
} catch(ex) { }
|
||||
_.defaults(options, null, undefined, {a:1});
|
||||
} catch(ex) {}
|
||||
|
||||
equal(options.a, 1, 'should not error on `null` or `undefined` sources');
|
||||
});
|
||||
@@ -351,16 +351,10 @@ $(document).ready(function() {
|
||||
|
||||
// Chaining.
|
||||
ok(!_.isEqual(_({x: 1, y: undefined}).chain(), _({x: 1, z: 2}).chain()), 'Chained objects containing different values are not equal');
|
||||
equal(_({x: 1, y: 2}).chain().isEqual(_({x: 1, y: 2}).chain()).value(), true, '`isEqual` can be chained');
|
||||
|
||||
// Custom `isEqual` methods.
|
||||
var isEqualObj = {isEqual: function (o) { return o.isEqual == this.isEqual; }, unique: {}};
|
||||
var isEqualObjClone = {isEqual: isEqualObj.isEqual, unique: {}};
|
||||
|
||||
ok(_.isEqual(isEqualObj, isEqualObjClone), 'Both objects implement identical `isEqual` methods');
|
||||
ok(_.isEqual(isEqualObjClone, isEqualObj), 'Commutative equality is implemented for objects with custom `isEqual` methods');
|
||||
ok(!_.isEqual(isEqualObj, {}), 'Objects that do not implement equivalent `isEqual` methods are not equal');
|
||||
ok(!_.isEqual({}, isEqualObj), 'Commutative equality is implemented for objects with different `isEqual` methods');
|
||||
a = _({x: 1, y: 2}).chain();
|
||||
b = _({x: 1, y: 2}).chain();
|
||||
equal(_.isEqual(a.isEqual(b), _(true)), true, '`isEqual` can be chained');
|
||||
|
||||
// Objects from another frame.
|
||||
ok(_.isEqual({}, iObject));
|
||||
|
||||
Reference in New Issue
Block a user