mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-01 15:57:48 +00:00
Ensure _.matches and _.matchesProperty work with function value params.
This commit is contained in:
20
test/test.js
20
test/test.js
@@ -9494,6 +9494,16 @@
|
||||
strictEqual(matches(object), true);
|
||||
});
|
||||
|
||||
test('should match properties when `value` is a function', 1, function() {
|
||||
function Foo() {}
|
||||
Foo.a = function() {};
|
||||
Foo.a.b = 1;
|
||||
Foo.a.c = 2;
|
||||
|
||||
var matches = _.matches({ 'a': { 'b': 1 } });
|
||||
strictEqual(matches(Foo), true);
|
||||
});
|
||||
|
||||
test('should match properties when `value` is not a plain object', 1, function() {
|
||||
function Foo(object) { _.assign(this, object); }
|
||||
|
||||
@@ -9672,6 +9682,16 @@
|
||||
strictEqual(matches(object), true);
|
||||
});
|
||||
|
||||
test('should match properties when `value` is a function', 1, function() {
|
||||
function Foo() {}
|
||||
Foo.a = function() {};
|
||||
Foo.a.b = 1;
|
||||
Foo.a.c = 2;
|
||||
|
||||
var matches = _.matchesProperty('a', { 'b': 1 });
|
||||
strictEqual(matches(Foo), true);
|
||||
});
|
||||
|
||||
test('should match properties when `value` is not a plain object', 1, function() {
|
||||
function Foo(object) { _.assign(this, object); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user