mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Add support in _.isEmpty and _.size for jQuery/MooTools DOM query collections.
Former-commit-id: dc834256d09d7a3f2797ba65690961aad00717bf
This commit is contained in:
14
test/test.js
14
test/test.js
@@ -713,6 +713,13 @@
|
||||
equal(_.isEmpty({ 'length': 0 }), false);
|
||||
});
|
||||
|
||||
test('should work with array-like collections', function() {
|
||||
function Foo(elements) { Array.prototype.push.apply(this, elements); }
|
||||
Foo.prototype = { 'splice': Array.prototype.splice };
|
||||
|
||||
equal(_.isEmpty(new Foo([])), true);
|
||||
});
|
||||
|
||||
test('should work with `arguments` objects (test in IE < 9)', function() {
|
||||
equal(_.isEmpty(args), false);
|
||||
});
|
||||
@@ -1084,6 +1091,13 @@
|
||||
equal(_.size({ 'length': 3 }), 1);
|
||||
});
|
||||
|
||||
test('should work with array-like collections', function() {
|
||||
function Foo(elements) { Array.prototype.push.apply(this, elements); }
|
||||
Foo.prototype = { 'splice': Array.prototype.splice };
|
||||
|
||||
equal(_.size(new Foo([1, 2, 3])), 3);
|
||||
});
|
||||
|
||||
test('should work with `arguments` objects (test in IE < 9)', function() {
|
||||
equal(_.size(args), 3);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user