|
272 | 272 | QUnit.module('lodash.contains'); |
273 | 273 |
|
274 | 274 | (function(){ |
275 | | -_.each([ |
276 | | -{'kind':'literal','value':'abc'}, |
277 | | -{'kind':'object','value':Object('abc')} |
278 | | -], |
279 | | -function(data){ |
280 | | -test('should work with a string '+data.kind+' for `collection`',function(){ |
281 | | -equal(_.contains(data.value,'bc'),true); |
282 | | -equal(_.contains(data.value,'d'),false); |
| 275 | +_.each({ |
| 276 | +'literal':'abc', |
| 277 | +'object':Object('abc') |
| 278 | +}, |
| 279 | +function(collection,key){ |
| 280 | +test('should work with a string '+key+' for `collection`',function(){ |
| 281 | +equal(_.contains(collection,'bc'),true); |
| 282 | +equal(_.contains(collection,'d'),false); |
283 | 283 | }); |
284 | 284 | }); |
285 | 285 | }()); |
|
508 | 508 | deepEqual(keys,['length']); |
509 | 509 | }); |
510 | 510 |
|
511 | | -_.each([ |
512 | | -{'kind':'literal','value':'abc'}, |
513 | | -{'kind':'object','value':Object('abc')} |
514 | | -], |
515 | | -function(data){ |
516 | | -test('should work with a string '+data.kind+' for `collection` (test in IE < 9)',function(){ |
| 511 | +_.each({ |
| 512 | +'literal':'abc', |
| 513 | +'object':Object('abc') |
| 514 | +}, |
| 515 | +function(collection,key){ |
| 516 | +test('should work with a string '+key+' for `collection` (test in IE < 9)',function(){ |
517 | 517 | varargs, |
518 | | -collection=data.value, |
519 | 518 | values=[]; |
520 | 519 |
|
521 | 520 | _.forEach(collection,function(value){ |
|
1151 | 1150 | deepEqual(args,expected); |
1152 | 1151 | }); |
1153 | 1152 |
|
1154 | | -_.each([ |
1155 | | -{'kind':'literal','value':'abc'}, |
1156 | | -{'kind':'object','value':Object('abc')} |
1157 | | -], |
1158 | | -function(data){ |
1159 | | -test('should work with a string '+data.kind+' for `collection` (test in IE < 9)',function(){ |
1160 | | -varargs, |
1161 | | -collection=data.value; |
| 1153 | +_.each({ |
| 1154 | +'literal':'abc', |
| 1155 | +'object':Object('abc') |
| 1156 | +}, |
| 1157 | +function(collection,key){ |
| 1158 | +test('should work with a string '+key+' for `collection` (test in IE < 9)',function(){ |
| 1159 | +varargs; |
1162 | 1160 |
|
1163 | 1161 | varactual=_.reduceRight(collection,function(accumulator,value){ |
1164 | 1162 | args||(args=slice.call(arguments)); |
|
1425 | 1423 | (function(){ |
1426 | 1424 | varargs=arguments; |
1427 | 1425 |
|
1428 | | -test('should call custom `toArray` method of an array',function(){ |
1429 | | -vararray=[1,2,3]; |
1430 | | -array.toArray=function(){return[3,2,1];}; |
1431 | | -deepEqual(_.toArray(array),[3,2,1]); |
| 1426 | +_.each({ |
| 1427 | +'an array':['a','b','c'], |
| 1428 | +'a string':Object('abc') |
| 1429 | +},function(collection,key){ |
| 1430 | +test('should call custom `toArray` method of '+key,function(){ |
| 1431 | +collection.toArray=function(){return[3,2,1];}; |
| 1432 | +deepEqual(_.toArray(collection),[3,2,1]); |
| 1433 | +}); |
1432 | 1434 | }); |
1433 | 1435 |
|
1434 | 1436 | test('should treat array-like objects like arrays',function(){ |
|