Enable over methods to accept matchesProperty shorthands.

This commit is contained in:
John-David Dalton
2016-04-04 23:44:44 -07:00
parent c084e358bd
commit 9999199d2b
2 changed files with 68 additions and 16 deletions

View File

@@ -16040,6 +16040,15 @@
assert.deepEqual(over(object), [false, true]);
});
QUnit.test('should work with "_.matchesProperty" shorthands', function(assert) {
assert.expect(2);
var over = _.over(['a', 2], [['b', 2]]);
assert.deepEqual(over({ 'a': 1, 'b': 2 }), [false, true]);
assert.deepEqual(over({ 'a': 2, 'b': 1 }), [true, false]);
});
QUnit.test('should provide arguments to predicates', function(assert) {
assert.expect(1);
@@ -16088,6 +16097,7 @@
assert.expect(2);
var over = _.overEvery(undefined, null);
assert.strictEqual(over(true), true);
assert.strictEqual(over(false), false);
});
@@ -16116,6 +16126,15 @@
assert.strictEqual(over(object), false);
});
QUnit.test('should work with "_.matchesProperty" shorthands', function(assert) {
assert.expect(2);
var over = _.overEvery(['a', 1], [['b', 2]]);
assert.strictEqual(over({ 'a': 1, 'b': 2 }), true);
assert.strictEqual(over({ 'a': 1, 'b': -2 }), false);
});
QUnit.test('should flatten `predicates`', function(assert) {
assert.expect(1);
@@ -16190,6 +16209,7 @@
assert.expect(2);
var over = _.overSome(undefined, null);
assert.strictEqual(over(true), true);
assert.strictEqual(over(false), false);
});
@@ -16218,6 +16238,15 @@
assert.strictEqual(over(object), false);
});
QUnit.test('should work with "_.matchesProperty" shorthands', function(assert) {
assert.expect(2);
var over = _.overSome(['a', 1], [['b', 2]]);
assert.strictEqual(over({ 'a': 3, 'b': 2 }), true);
assert.strictEqual(over({ 'a': 2, 'b': 3 }), false);
});
QUnit.test('should flatten `predicates`', function(assert) {
assert.expect(1);